List of usage examples for java.util Locale US
Locale US
To view the source code for java.util Locale US.
Click Source Link
From source file:Main.java
/** * Capitalizes the first letter of the string and converts '_' to ' '. * * That is, where the name is "field_name", this will return "Field name". *//* w w w . j ava 2s . c o m*/ private static String formatFieldName(String name) { return name.substring(0, 1).toUpperCase(Locale.US) + name.substring(1).replace('_', ' ').trim(); }
From source file:Main.java
/** * Get the current date as a string//from w w w. j a v a 2s . c o m * @return Current time */ public static String getNow() { return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US).format(new Date()); }
From source file:Main.java
public static String convertTimeInMillis2DayString(long millis) { if (millis <= 0) return "" + millis; else {//from w w w. j a v a 2s. co m SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd", Locale.US); return sdf.format(new Date(millis)); } }
From source file:Main.java
public static String getDayOfWeekString(int day) { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.DAY_OF_WEEK, day); SimpleDateFormat format = new SimpleDateFormat("EEE", Locale.US); return format.format(calendar.getTime()); }
From source file:Main.java
public static String convertTimeInMillis2String(long millis) { if (millis <= 0) return "" + millis; else {// w w w . j a v a 2s . co m SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.US); return sdf.format(new Date(millis)); } }
From source file:Main.java
public static String getMonthOfYearString(int month) { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.MONTH, month - 1); SimpleDateFormat format = new SimpleDateFormat("MMM", Locale.US); return format.format(calendar.getTime()); }
From source file:Main.java
public static String convertTimeInMillis2NiceStr(long millis) { if (millis <= 0) return "" + millis; else {// ww w . ja v a 2 s.c om SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.US); return sdf.format(new Date(millis)); } }
From source file:Main.java
private static boolean deleteFileWithExceptsInner(File file, String suffix, String[] exceptFileNames, AtomicBoolean excepted) { String fileName = file.getName().toLowerCase(Locale.US); if (canDeleteWithSuffixInner(fileName, suffix) && !equalsFileNamesInner(fileName, exceptFileNames)) { return file.delete(); } else {/*from w ww . j a v a 2 s.co m*/ if (excepted != null) excepted.set(true); } return true; }
From source file:Main.java
public static String getSystemTime(boolean hour24Mode) { // yyyy-MM-dd hh:mm:ss String format = "HH:mm"; if (!hour24Mode) { format = "hh:mm"; }/* w w w .j a v a2s .c om*/ SimpleDateFormat sdf = new SimpleDateFormat(format, Locale.US); String date = sdf.format(new java.util.Date()); return date; }
From source file:Main.java
public static Date dateXMLStringToDateParser(String sDate) { Date date = null;//w ww . jav a 2s . c o m try { SimpleDateFormat formatter = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z", Locale.US); date = formatter.parse(sDate); } catch (ParseException e) { e.printStackTrace(); } return date; }