List of usage examples for java.util Locale ENGLISH
Locale ENGLISH
To view the source code for java.util Locale ENGLISH.
Click Source Link
From source file:Main.java
public static String toModifiedTimeString(Date modified) { long time = modified.getTime(); double timed = time / 1000.0; String retval = String.format(Locale.ENGLISH, "%.2f", timed); // Dbg.debug("TIME: " + retval); return retval; }
From source file:Main.java
/** * Get the Date from String with custom format. Default format is yyyy-MM-dd * * @param dateString// w w w .j a v a2 s . co m * @param dateFormat * @return * @throws ParseException */ public static Date getDateFromString(String dateString, String dateFormat, Locale locale) throws ParseException { SimpleDateFormat formatter; if (dateFormat == null) { if (yyyyMMddFormat == null) { setup(locale); } formatter = yyyyMMddFormat; } else { formatter = new SimpleDateFormat(dateFormat, Locale.ENGLISH); } return formatter.parse(dateString); }
From source file:Main.java
static boolean isKeyword(String term) { return KEYWORDS.contains(term.toUpperCase(Locale.ENGLISH)); }
From source file:Main.java
public static String dateToString(Date date) { String dateString = ""; SimpleDateFormat simpleDateFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzzzZ yyyy", Locale.ENGLISH); dateString = simpleDateFormat.format(date); return dateString; }
From source file:Main.java
public static Date strToDate(String dateString) { SimpleDateFormat simpleDateFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzzzZ yyyy", Locale.ENGLISH); Date date = null;/*w w w . j a v a2 s. c om*/ try { date = simpleDateFormat.parse(dateString); } catch (ParseException e) { e.printStackTrace(); } return date; }
From source file:Main.java
public static boolean compareIgnoreCase(String str1, String str2) { return str1.toLowerCase(Locale.ENGLISH).equals(str2.toLowerCase(Locale.ENGLISH)); }
From source file:Main.java
public static String getStringByDateFormat(String strDate, String format) { String mDateTime = null;// w ww . j a v a2s . com try { Calendar c = new GregorianCalendar(); SimpleDateFormat mSimpleDateFormat = new SimpleDateFormat("MMM dd,yyyy kk:mm:ss aa", Locale.ENGLISH); c.setTime(mSimpleDateFormat.parse(strDate)); SimpleDateFormat mSimpleDateFormat2 = new SimpleDateFormat(format); mDateTime = mSimpleDateFormat2.format(c.getTime()); } catch (Exception e) { e.printStackTrace(); } return mDateTime; }
From source file:Main.java
public static long getTimeAsMillisecs(final Object iSize) { if (iSize == null) throw new IllegalArgumentException("Time is null"); if (iSize instanceof Number) // MILLISECS return ((Number) iSize).longValue(); String time = iSize.toString(); boolean number = true; for (int i = time.length() - 1; i >= 0; --i) { if (!Character.isDigit(time.charAt(i))) { number = false;//from w w w.j a va 2 s . c om break; } } if (number) // MILLISECS return Long.parseLong(time); else { time = time.toUpperCase(Locale.ENGLISH); int pos = time.indexOf("MS"); if (pos > -1) return Long.parseLong(time.substring(0, pos)); pos = time.indexOf("S"); if (pos > -1) return Long.parseLong(time.substring(0, pos)) * SECOND; pos = time.indexOf("M"); if (pos > -1) return Long.parseLong(time.substring(0, pos)) * MINUTE; pos = time.indexOf("H"); if (pos > -1) return Long.parseLong(time.substring(0, pos)) * HOUR; pos = time.indexOf("D"); if (pos > -1) return Long.parseLong(time.substring(0, pos)) * DAY; pos = time.indexOf('W'); if (pos > -1) return Long.parseLong(time.substring(0, pos)) * WEEK; pos = time.indexOf('Y'); if (pos > -1) return Long.parseLong(time.substring(0, pos)) * YEAR; // RE-THROW THE EXCEPTION throw new IllegalArgumentException("Time '" + time + "' has a unrecognizable format"); } }
From source file:Main.java
public static String format(String format, Date date) { return new SimpleDateFormat(format, Locale.ENGLISH).format(date); }
From source file:com.omnigon.aem.common.utils.LocaleUtils.java
public static boolean isValidAndNonEnglish(Locale locale) { return locale != null && StringUtils.isNotBlank(locale.getLanguage()) && !StringUtils.equalsIgnoreCase(Locale.ENGLISH.getLanguage(), locale.getLanguage()); }