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
/** * Get the current date and time formatted as expected by PBS' application. * @return/*from w ww.ja v a2s . c o m*/ */ public static String getCurrentTimeStamp() { SimpleDateFormat sdf = new SimpleDateFormat("MMM dd, yyyy HH:mm:ss.SSS", Locale.US); Date now = new Date(); return sdf.format(now); }
From source file:Main.java
/** * Gets the current day of week./*from ww w . j a v a2 s .com*/ * * @return current day of week. */ public static String getActualDayOfWeek() { Date date = new Date(); String actualDayOfWeek = new SimpleDateFormat("EE", Locale.US).format(date); return actualDayOfWeek; }
From source file:Main.java
public static String normalizeDate(String rDate) { SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-mm-dd", Locale.US); Date date = null;/*from www .j a va 2 s.c o m*/ try { date = simpleDateFormat.parse(rDate); } catch (ParseException e) { e.printStackTrace(); } return DateFormat.getDateInstance(DateFormat.LONG).format(date); }
From source file:Main.java
public static void updateLabel(EditText et, Calendar calendar) { String format = "dd/MM/yyyy"; SimpleDateFormat sdf = new SimpleDateFormat(format, Locale.US); et.setText(sdf.format(calendar.getTime())); }
From source file:Main.java
public static String getShortMonthStringOnlyFromDate(Date date) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date);/* w w w . j av a 2 s . c om*/ SimpleDateFormat format = new SimpleDateFormat("MMM", Locale.US); return format.format(date); }
From source file:Main.java
public static String timestamp() { String timestamp = null;/* ww w . java 2 s . c o m*/ Calendar cal = Calendar.getInstance(); DateFormat dfm = new SimpleDateFormat("yyyy-MM-ddHH:mm:ss", Locale.US); dfm.setTimeZone(TimeZone.getTimeZone("GMT")); timestamp = dfm.format(cal.getTime()); return timestamp; }
From source file:Main.java
public static String roundWithTwoDecimals(double number) { try {/* ww w .j a va 2 s. c om*/ // format based on default locale DecimalFormat df = (DecimalFormat) NumberFormat.getInstance(Locale.US); DecimalFormatSymbols dfs = df.getDecimalFormatSymbols(); df.setDecimalFormatSymbols(dfs); df.applyPattern("#####0.00"); return df.format(number); } catch (IllegalArgumentException e) { return null; } }
From source file:Main.java
public static String formatDate(Date date) { if (date != null) { if (mDateFormatter == null) { mDateFormatter = new SimpleDateFormat("dd/MM/yyyy HH:mm", Locale.US); }//from w ww. jav a2 s. co m return mDateFormatter.format(date); } else { return "No update date"; } }
From source file:Main.java
public static String getTimeString(Date paramDate) { if (paramDate == null) return ""; return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US).format(paramDate); }
From source file:Main.java
/** * Calculate bucket id for the specified path. * @param imageFilePath the file path of the local storage. * @return an identifier of the album bucket. *///www .ja va 2s . c o m public static int getBucketIdHash(String imageFilePath) { return imageFilePath.toLowerCase(Locale.US).hashCode(); }