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 Date stringToDate(String dateString) { SimpleDateFormat format = new SimpleDateFormat("yyyy/MM/dd HH:mm", Locale.ENGLISH); try {/*from www .j a va 2s . co m*/ return format.parse(dateString); } catch (ParseException e) { e.printStackTrace(); } return null; }
From source file:Main.java
public static Date stringToDate3(String date) throws ParseException { DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", Locale.ENGLISH); Date _date = format.parse(date); return _date; }
From source file:Main.java
public static String getTime(String date_long) { Long time_millisecond = Long.parseLong(date_long); Date date = new Date(time_millisecond); SimpleDateFormat dateFormat = new SimpleDateFormat("h:mm a", Locale.ENGLISH); return dateFormat.format(date); }
From source file:Main.java
public static String getDate(String date_long) { Long time_millisecond = Long.parseLong(date_long); Date date = new Date(time_millisecond); SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM", Locale.ENGLISH); return dateFormat.format(date); }
From source file:Main.java
public static Calendar getFinishDate(String startDate, String duration) { try {//from w w w.jav a 2s .c o m SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH); Calendar calendarFinish = Calendar.getInstance(); calendarFinish.setTime(sdf.parse(startDate)); calendarFinish.add(Calendar.DATE, Integer.parseInt(duration)); return calendarFinish; } catch (ParseException e) { Log.e("PARSE_FAIL", Log.getStackTraceString(e)); } return null; }
From source file:Main.java
public static String padString(String str) { if (str == null || str.isEmpty()) { return "0"; } else if (str.equals(".")) { return "0."; } else {/* w ww . j a va2 s.c om*/ try { return String.format(Locale.ENGLISH, "%.4f", Double.parseDouble(str)); } catch (Exception e) { return null; } } }
From source file:Main.java
public static Date stringToDate(String dateString) { try {//from w ww . j a v a2s .c o m return new SimpleDateFormat(DATE_STORAGE_FORMAT, Locale.ENGLISH).parse(dateString); } catch (ParseException pex) { return new Date(0L); } }
From source file:Main.java
public static String convertUnixDateTimeToString(Long unixDateTime) { java.util.Date time = new java.util.Date(unixDateTime); DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.ENGLISH); return dateFormat.format(time); }
From source file:Main.java
public static String getExtensionFromFileName(String fileName) { int slash = fileName.lastIndexOf(File.separatorChar); int dot = fileName.lastIndexOf('.'); if (slash >= dot) { return null; }//from w ww.j a v a2 s .co m String extension = fileName.substring(dot + 1).toLowerCase(Locale.ENGLISH); return extension; }
From source file:Main.java
public static String calculateAge(Context context, String date) { final String FACEBOOK = "MM/dd/yyyy"; try {//from w ww. j av a 2s. c o m SimpleDateFormat sf = new SimpleDateFormat(FACEBOOK, Locale.ENGLISH); sf.setLenient(true); Date birthDate = sf.parse(date); Date now = new Date(); int age = now.getYear() - birthDate.getYear(); birthDate.setHours(0); birthDate.setMinutes(0); birthDate.setSeconds(0); birthDate.setYear(now.getYear()); if (birthDate.after(now)) { age -= 1; } return Integer.toString(age); } catch (Exception e) { Log.d("DEBUG", "exception in getTwitterDate:"); e.printStackTrace(); return "Unknown"; } }