List of usage examples for java.text SimpleDateFormat format
public final String format(Date date)
From source file:Main.java
public static void getWeekDate(long startUnix, int week) { startUnix += week * 7 * 86400 * 1000; Date date = new Date(startUnix); SimpleDateFormat eDateFormat = new SimpleDateFormat("E"); int iE = Integer.parseInt(eDateFormat.format(date)); }
From source file:Main.java
@SuppressLint("SimpleDateFormat") public static String getPhotoFileName() { Date date = new Date(System.currentTimeMillis()); SimpleDateFormat dateFormat = new SimpleDateFormat("'IMG'_yyyyMMdd_HHmmss"); return dateFormat.format(date) + ".jpg"; }
From source file:Main.java
public static String getTimestamp(Date date) { SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_HHmmss"); return sdf.format(date); }
From source file:Main.java
public static String TimestampToString(Timestamp timestamp, String pattern) { SimpleDateFormat df = new SimpleDateFormat(pattern); try {// w w w. j a va2s . com return df.format(timestamp); } catch (Exception e) { return ""; } }
From source file:Main.java
public static String millisToStringDate(long millis, String pattern) { SimpleDateFormat format = new SimpleDateFormat(pattern, Locale.getDefault()); return format.format(new Date(millis)); }
From source file:Main.java
public static String getCurrentTime() { SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); String currentDateAndTime = sdf.format(new Date()); return currentDateAndTime; }
From source file:Main.java
/** * @return// www .j a v a 2 s. c o m */ public static String getCurrentTime() { SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); String date = sf.format(new Date()); return date; }
From source file:Main.java
public static String getDate(String pubDate) { Date date = new Date(Long.parseLong(pubDate) * 1000); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm"); return simpleDateFormat.format(date); }
From source file:Main.java
public static String getPhotoFileName() { Date date = new Date(System.currentTimeMillis()); SimpleDateFormat dateFormat = new SimpleDateFormat("'IMG'_yyyy-MM-dd-HHmmss"); return dateFormat.format(date) + ".jpg"; }
From source file:Main.java
public static boolean timeIsTodayTime(Date date) { if (date == null) { return false; }// w w w. j a va 2 s. c o m SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); String paramDate = sdf.format(date); String nowDate = sdf.format(new Date()); return paramDate.equals(nowDate); }