List of usage examples for java.util Locale getDefault
public static Locale getDefault()
From source file:Main.java
public static String getDateStringInFormat(long date) { SimpleDateFormat sdf = new SimpleDateFormat("MMM MM dd, yyyy h:mm a", Locale.getDefault()); return sdf.format(date); }
From source file:Main.java
public static Date getDateTime() { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()); Date date;/* w w w. jav a 2 s.c om*/ date = new Date(); return date; //return dateFormat.format(date); }
From source file:Main.java
public static Locale createLocaleFromString(String localeStr) { if (null == localeStr) return Locale.getDefault(); String[] brokenDownLocale = localeStr.split("_", 3); if (1 == brokenDownLocale.length) { return new Locale(brokenDownLocale[0]); } else if (2 == brokenDownLocale.length) { return new Locale(brokenDownLocale[0], brokenDownLocale[1]); } else {//from w w w . j a v a 2 s .c om return new Locale(brokenDownLocale[0], brokenDownLocale[1], brokenDownLocale[2]); } }
From source file:Main.java
public static String timeToString() { SimpleDateFormat sdf = new SimpleDateFormat("ddMMyyyyhhmmss", Locale.getDefault()); Calendar data = Calendar.getInstance(); return sdf.format(data.getTime()); }
From source file:Main.java
public static boolean isTomorrow(Calendar cal) { Calendar tomorrow = Calendar.getInstance(Locale.getDefault()); tomorrow.roll(Calendar.DAY_OF_YEAR, true); return cal.get(Calendar.DAY_OF_YEAR) == tomorrow.get(Calendar.DAY_OF_YEAR) && cal.get(Calendar.YEAR) == tomorrow.get(Calendar.YEAR); }
From source file:Main.java
public static String formatDate(long millis) { SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd", Locale.getDefault()); return format.format(new Date(millis)); }
From source file:Main.java
public static String getCurrentDate() { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd", Locale.getDefault()); Date date = new Date(); return dateFormat.format(date); }
From source file:Main.java
public static String getSimpleTimestamp() { SimpleDateFormat format = new SimpleDateFormat("yyyyMMDD", Locale.getDefault()); return format.format(Calendar.getInstance().getTime()); }
From source file:Main.java
public static boolean isYesterday(Calendar cal) { Calendar yesterday = Calendar.getInstance(Locale.getDefault()); yesterday.roll(Calendar.DAY_OF_YEAR, false); return cal.get(Calendar.DAY_OF_YEAR) == yesterday.get(Calendar.DAY_OF_YEAR) && cal.get(Calendar.YEAR) == yesterday.get(Calendar.YEAR); }
From source file:Main.java
public static String getTimeString(Calendar time) { SimpleDateFormat format = new SimpleDateFormat("h:mm a", Locale.getDefault()); return format.format(time.getTime()); }