List of usage examples for java.text SimpleDateFormat SimpleDateFormat
public SimpleDateFormat(String pattern)
SimpleDateFormat
using the given pattern and the default date format symbols for the default java.util.Locale.Category#FORMAT FORMAT locale. From source file:Main.java
public static String DateToString(Date date) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); return sdf.format(date); }
From source file:Main.java
public static String formatDateYYYYMMDD() { SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); return sdf.format(new Date()); }
From source file:Main.java
public static String getTimeString(Date date) { SimpleDateFormat df = new SimpleDateFormat("h:mma"); return df.format(date); }
From source file:Main.java
public static String getHumanDate(long mils) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); return sdf.format(new Date(mils)); }
From source file:Main.java
public static String getDateString(Date date) { SimpleDateFormat df = new SimpleDateFormat("E, MMM d"); return df.format(date); }
From source file:Main.java
public static String getRomoteName(String id) { SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); return "android_" + id + "_" + sdf.format(new Date()); }
From source file:Main.java
public static String getCurrentTimeString() { SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss"); return formatter.format(new Date()); }
From source file:Main.java
public static String getTodayDateString() { SimpleDateFormat formatter = new SimpleDateFormat("MM-dd-yyyy"); String dateString = formatter.format(new Date()); return dateString; }
From source file:Main.java
public static String toLocalTime(Date d) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String targetString = sdf.format(d); return targetString; }
From source file:Main.java
public static boolean checkDate(String str) { SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); try {//ww w . j a v a 2 s . c o m formatter.parse(str); return true; } catch (Exception e) { return false; } }