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
/** * Transform Calendar to ISO 8601 string. *///from ww w. j a v a 2s .com public static String dateToString(final Date date) { if (date == null) { return null; } String formatted = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.US).format(date); return formatted.substring(0, 22) + ":" + formatted.substring(22); }
From source file:Main.java
public static String getMonthStringFromDate(Date date) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date);/*from www. j ava 2 s. co m*/ StringBuilder sb = new StringBuilder(); sb.append(calendar.getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.US)).append(", ") .append(calendar.get(Calendar.YEAR)); return sb.toString(); }
From source file:Main.java
/** * Checks current locale settings to select a language which should be used for communication with MCI. * //from w w w. ja v a 2 s.c o m * @return Code of language to use for MCI communication */ public static final String getMciLanguageCode() { String lowerLanguage = Locale.getDefault().getLanguage().toLowerCase(Locale.US); if (lowerLanguage.startsWith("cs") || lowerLanguage.startsWith("sk")) { return "cs"; } else { return "en"; } }
From source file:Main.java
public static Date parseDateString(String dateString) { // "2014-04-26 09:00:22" Date date = null;//from w w w. j a v a2s . c om SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss", Locale.US); try { date = dateFormat.parse(dateString); } catch (ParseException e) { e.printStackTrace(); } return date; }
From source file:Main.java
private static String UpperCase(String str) { int len = str.length(); String result = ""; for (int i = 0; i < len; i++) { String subStr = str.substring(i, i + 1); char subChar = str.charAt(i); if (subChar >= 'a' && subChar <= 'z') result += subStr.toUpperCase(Locale.US); else/* w w w . jav a 2 s .c o m*/ result += subStr; } return result; }
From source file:Main.java
/** * VERY UGLY. THIS NEEDS A REGEXP// w ww . j av a 2 s .c o m * * @param text1 The container text * @param text2 The text we are looking for * @return true if {@param text1} contains {@param text2} */ public static boolean containsIgnoreCase(final String text1, final String text2) { return text1.toLowerCase(Locale.US).contains(text2.toLowerCase(Locale.US)); }
From source file:Main.java
public static String formatDateForCookie(Date date) { // for http cookie final String PATTERN_RFC1123 = "EEE, dd MMM yyyy HH:mm:ss zzz"; SimpleDateFormat format = new SimpleDateFormat(PATTERN_RFC1123, Locale.US); format.setTimeZone(TimeZone.getTimeZone("GMT")); return format.format(date); }
From source file:Main.java
private static String createStandardNumber(Object input) { // MOD SeB 11/03/2010 bug 11751 : convert number to String using current locale // MOD yyi 2010-04-15 bug 12483 : Unify the decimal format as US. return NumberFormat.getInstance(Locale.US).format(input); }
From source file:Main.java
public static void setHttpResponseDate(String date) { try {//from w w w .j av a 2s.co m DateFormat fmt = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US); Date d = fmt.parse(date.trim()); if (d.getTime() < RELEASE_ZERO_TIMESTAMP) return; TIME_CALIBRATOR = d.getTime() - System.currentTimeMillis(); } catch (Exception e) { // just ignore } catch (Error error) { // just ignore } }
From source file:Main.java
/** * Transform ISO 8601 string to Calendar. *//* w ww . j a v a 2s . co m*/ public static Date stringToDate(final String iso8601string) { try { String s = iso8601string.replace("Z", "+00:00"); s = s.substring(0, 22) + s.substring(23); return new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.US).parse(s); } catch (Exception e) { return null; } }