Example usage for java.util Locale US

List of usage examples for java.util Locale US

Introduction

In this page you can find the example usage for java.util Locale US.

Prototype

Locale US

To view the source code for java.util Locale US.

Click Source Link

Document

Useful constant for country.

Usage

From source file:Main.java

public static String getFormattedTimeInterval(long millis) {
    return String.format(Locale.US, "%02d:%02d", TimeUnit.MILLISECONDS.toMinutes(millis),
            TimeUnit.MILLISECONDS.toSeconds(millis)
                    - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(millis)));
}

From source file:Main.java

public static String ToString(Calendar date) {
    SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy", Locale.US);
    return sdf.format(date.getTime());
}

From source file:Main.java

public static String readableDate(Date date) {
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd", Locale.US);
    String formattedDate = sdf.format(date);
    return formattedDate;
}

From source file:Main.java

public static Calendar parseTimestamp(String timestamp) throws Exception {
    SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss", Locale.US);
    Date d = sdf.parse(timestamp);
    Calendar cal = Calendar.getInstance();
    cal.setTime(d);//from   www  . ja va  2 s  . co  m
    return cal;
}

From source file:Main.java

public static String getTimeStamp_1() {
    SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd-HH:mm:ss", Locale.US);
    Date curDate = new Date(System.currentTimeMillis());
    return formatter.format(curDate);
}

From source file:Main.java

public static SimpleDateFormat getDateFormat() {
    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd", Locale.US);
    format.setTimeZone(TimeZone.getTimeZone("UTC"));
    return format;
}

From source file:Main.java

public static String getTimeStamp_2() {
    SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd-HH:mm:ss:SSS", Locale.US);
    Date curDate = new Date(System.currentTimeMillis());
    return formatter.format(curDate);
}

From source file:Main.java

public static boolean isOGMFile(String in) {
    return in.toLowerCase(Locale.US).endsWith(".ogm");
}

From source file:Main.java

public static String getDateDisplay(Calendar cal) {
    return cal.getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.US) + " " + cal.get(Calendar.DATE) + ", "
            + cal.get(Calendar.YEAR);
}

From source file:Main.java

public static String formatAmount(int amount, String currency) {
    if ("HUF".equals(currency)) {
        return String.format(Locale.US, "%d " + currency, amount);
    } else {//ww  w . j  a  v a2 s .c o  m
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("%d,%02d ");
        stringBuilder.append(currency);
        return String.format(Locale.US, stringBuilder.toString(), amount / 100, amount % 100);
    }
}