List of usage examples for java.text SimpleDateFormat format
public final String format(Date date)
From source file:Main.java
public static boolean equalsMonth(Date a, Date b) { SimpleDateFormat yearFormat = new SimpleDateFormat("yyyyMM", locale); return yearFormat.format(a).equals(yearFormat.format(b)); }
From source file:Main.java
public static boolean isToday(Date date) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd", Locale.CHINA); return sdf.format(date).equals(sdf.format(new Date())); }
From source file:Main.java
public static String parseDateToString(Date date) { SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); return formatter.format(date); }
From source file:Main.java
public static String getFormatDate(java.util.Date date) { SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmSS"); return sdf.format(date); }
From source file:Main.java
public static String formatExpireDate(Date expireDate) { SimpleDateFormat format = new SimpleDateFormat("MM/yyyy", Locale.FRANCE); return format.format(expireDate); }
From source file:Main.java
public static String getToday() { SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd", Locale.CHINA); return sdf.format(new Date()); }
From source file:Main.java
public static String dateToStr(Date date) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); return sdf.format(date); }
From source file:Main.java
public static int getYear() { Calendar calendar = Calendar.getInstance(); SimpleDateFormat yearSdf = new SimpleDateFormat("yyyy"); String yearString = yearSdf.format(calendar.getTime()); return Integer.parseInt(yearString); }
From source file:Main.java
public static String convertTime2DateHms(long longtime) { SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); String str = sdf.format(longtime); return str;//from w ww . j a v a2s. c om }
From source file:Main.java
public static String formatDate(Date date) { SimpleDateFormat formater = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); return formater.format(date); }