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 formatLatitudeLongitude(String format, double latitude, double longitude) { // We need to specify the locale otherwise it may go wrong in some language // (e.g. Locale.FRENCH) return String.format(Locale.ENGLISH, format, latitude, longitude); }
From source file:Main.java
public static String dateToString(Date date) { return new SimpleDateFormat(DATE_STORAGE_FORMAT, Locale.ENGLISH).format(date); }
From source file:Main.java
public static Date getDate(String stringDate) { DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.ENGLISH); Date date = null;/*from www . j av a 2s .c o m*/ try { date = format.parse(stringDate); } catch (ParseException e) { } return date; }
From source file:Main.java
public static boolean validTime(String str, String pattern) { DateFormat formatter = new SimpleDateFormat(pattern, Locale.ENGLISH); Date date = null;//from www.ja v a 2 s .c om try { date = (Date) formatter.parse(str); } catch (ParseException e) { return false; } return str.equals(formatter.format(date)); }
From source file:Main.java
public static String getStringDate(long l) { Date date = new Date(Long.parseLong((new StringBuilder()).append(l).append("000").toString())); return (new SimpleDateFormat("dd MMM yyyy", Locale.ENGLISH)).format(date); }
From source file:Main.java
public static String[] getCalendarShowTime(long paramLong) { String[] localObject;//from ww w . java 2 s. c om String str = new SimpleDateFormat("yyyy:MMM:d", Locale.ENGLISH).format(new Date(paramLong)); try { String[] arrayOfString = str.split(":"); localObject = arrayOfString; if ((localObject != null) && (localObject.length == 3)) ; return localObject; } catch (Exception localException) { while (true) localException.printStackTrace(); } }
From source file:Main.java
public static Date stringToDate4(String date) throws ParseException { DateFormat format = new SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH); Date _date = format.parse(date); return _date; }
From source file:Main.java
public static Date convertDateTimeToDate(String dateTime) { DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS", Locale.ENGLISH); Date date = null;//from w ww. j a v a2 s . c o m try { date = format.parse(dateTime); } catch (ParseException e) { e.printStackTrace(); } // System.out.println(date); return date; }
From source file:Main.java
public static String formatBits(long bytes) { int unit = 1024; if (bytes < unit) return bytes + " B"; int exp = (int) (Math.log(bytes) / Math.log(unit)); String pre = ("KMGTPE").charAt(exp - 1) + ""; return String.format(Locale.ENGLISH, "%.1f %sb", bytes / Math.pow(unit, exp), pre); }
From source file:Main.java
public static String formatBytes(long bytes) { int unit = 1024; if (bytes < unit) return bytes + " B"; int exp = (int) (Math.log(bytes) / Math.log(unit)); String pre = ("KMGTPE").charAt(exp - 1) + ""; return String.format(Locale.ENGLISH, "%.1f %sB", bytes / Math.pow(unit, exp), pre); }