List of usage examples for java.text SimpleDateFormat format
public final String format(Date date)
From source file:Main.java
public static String calendar2LongString(Calendar calendar) { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:00"); return format.format(calendar.getTime()); }
From source file:Main.java
public static String getFileName() { Date date = new Date(System.currentTimeMillis()); SimpleDateFormat sdf = new SimpleDateFormat("'img'yyyyMMddHHmmss"); return sdf.format(date) + ".jpg"; }
From source file:Main.java
/** * ????String/*from www . j a v a2 s .c o m*/ * * @param time * @return */ public static String getDateString(long time) { Date date = new Date(time); SimpleDateFormat sdf = new SimpleDateFormat("yyyy:MM:dd"); return sdf.format(date); }
From source file:Main.java
public static String convertTime2DateDShort(long longtime) { SimpleDateFormat sdf = new SimpleDateFormat("HH:mm"); String str = sdf.format(longtime); return str;//from w w w . j av a 2 s.c om }
From source file:Main.java
@SuppressLint("SimpleDateFormat") public static String nowTimeString() { String str = null;// w w w . j a v a 2s . co m SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddhhmmsss"); str = sdf.format(new Date()); return str; }
From source file:Main.java
public static String setTimeClock(long time) { SimpleDateFormat format = new SimpleDateFormat("HH:mm"); String timeDate = format.format(new Date(time)); return timeDate; }
From source file:Main.java
public static String getTimeByLong(long time) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd"); String date = sdf.format(new Date(time)); return date;//from w ww . j a v a 2s . com }
From source file:Main.java
public static String getChangeDateFormat(Date date) { String str = null;/*from ww w . j a va2 s.c o m*/ if (date != null && !"".equals(date)) { SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); str = sd.format(date); } return str; }
From source file:Main.java
/** * Get String time by long./*from w w w. j ava 2s . c o m*/ * * @param timeInMillis * @param format use format from FDataUtil. {@link FTimeUtil#FORMAT_1} * @return */ public static String getTime(long timeInMillis, String format) { SimpleDateFormat df = new SimpleDateFormat(format); return df.format(new Date(timeInMillis)); }
From source file:Main.java
public static String getFullDate(long date) { SimpleDateFormat fullDateFormat = new SimpleDateFormat("dd.MM.yy HH:mm"); return fullDateFormat.format(date); }