List of usage examples for java.util Locale getDefault
public static Locale getDefault()
From source file:Main.java
public static String getDateTime() { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault()); Date date = new Date(); return dateFormat.format(date); }
From source file:Main.java
public static String getFormatDate(long time) { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()); Date date = new Date(time); return format.format(date); }
From source file:Main.java
public static String dateGetString(Date date) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd", Locale.getDefault()); String dateFormat = sdf.format(date); return dateFormat; }
From source file:Main.java
public static String formatDate(Date date) { SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy", Locale.getDefault()); return dateFormat.format(date); }
From source file:Main.java
public static String getDateString(Calendar date) { SimpleDateFormat format = new SimpleDateFormat("d MMMM yyyy", Locale.getDefault()); return format.format(date.getTime()); }
From source file:Main.java
public static boolean isRtl() { return TextUtilsCompat.getLayoutDirectionFromLocale(Locale.getDefault()) == ViewCompat.LAYOUT_DIRECTION_RTL; }
From source file:Main.java
public static String getCurrentTime(String format) { Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat(format, Locale.getDefault()); sdf.setTimeZone(TimeZone.getTimeZone("GMT+8")); String currentTime = sdf.format(date); return currentTime; }
From source file:Main.java
public static Date formatDateDayFirst(String date) { try {//from ww w . j a va2s . co m return new SimpleDateFormat("dd-MM-yyyy", Locale.getDefault()).parse(date.replace("/", "-")); } catch (Exception e) { return null; } }
From source file:Main.java
public final static String convertFristToUpperCase(String temp) { String frist = temp.substring(0, 1); String other = temp.substring(1); return frist.toUpperCase(Locale.getDefault()) + other; }
From source file:Main.java
public static Date parseDate(String val, String pattern) { try {//from ww w. ja v a2 s . com return new SimpleDateFormat(pattern, Locale.getDefault()).parse(val); } catch (Exception e) { return null; } }