List of usage examples for java.util Locale getDefault
public static Locale getDefault()
From source file:Main.java
public static String getTime() { Date date = new Date(); DateFormat format = new SimpleDateFormat("HH:mm", Locale.getDefault()); return format.format(date); }
From source file:Main.java
public static String getDateFromCal(String pattern, Calendar cal) { DateFormat df = new SimpleDateFormat(pattern, Locale.getDefault()); return df.format(cal.getTime()); }
From source file:Main.java
private static String getOutTradeNo() { SimpleDateFormat format = new SimpleDateFormat("MMddHHmmss", Locale.getDefault()); Date date = new Date(); String key = format.format(date); Random r = new Random(); key = key + r.nextInt();//w ww. ja v a 2 s . c o m key = key.substring(0, 15); return key; }
From source file:Main.java
/** * /*w w w .ja v a 2 s . co m*/ */ public static String millisToGMT(long millis) { SimpleDateFormat df = new SimpleDateFormat("MM_dd_yyyy_hh_mm", Locale.getDefault()); df.setTimeZone(TimeZone.getTimeZone("GMT")); return df.format(millis) + "_UTC"; }
From source file:Main.java
public static String getPhotoFileName() { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.getDefault()); Date date = new Date(); return Environment.getExternalStorageDirectory().getPath() + "/DCIM/100ANDRO/Todo_" + dateFormat.format(date) + ".jpg"; }
From source file:Main.java
public static String currentTime() { Date now = new Date(); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.getDefault()); return dateFormat.format(now); }
From source file:Main.java
public static Locale get() { return firstNonNull(THREAD_LOCAL.get(), Locale.getDefault()); }
From source file:Main.java
public synchronized static String getOutTradeNo() { SimpleDateFormat format = new SimpleDateFormat("MMddHHmmss", Locale.getDefault()); Date date = new Date(); String key = format.format(date); Random r = new Random(); key = key + r.nextInt();/*w ww .ja va2 s .c o m*/ key = key.substring(0, 15); return key; }
From source file:Main.java
/** * /*from w ww.ja v a 2s.c om*/ * @param variation * @return */ public static String makeVariation(double variation) { int var = (int) Math.round(variation); String ret = String.format(Locale.getDefault(), "%02d", var); if (var < 0) { ret = "E" + var + "\u00B0 "; } else { ret = "W" + var + "\u00B0 "; } return ret; }
From source file:Main.java
public static String toYYYYMM(Calendar source) { if (source != null) { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM", Locale.getDefault()); return format.format(source.getTime()); }// w ww.ja v a 2 s . c o m return null; }