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

/**
 * generate new image path file//from   w  w w . j a v  a  2 s.  co  m
 *
 * @return
 */
public static File generateImagePath() {
    try {
        File storageDir = getAlbumDir();
        String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.US).format(new Date());
        return new File(storageDir, "IMG_" + timeStamp + ".jpeg");
    } catch (Exception e) {
        Log.d("android_utilities", "the error is " + e);
    }
    return null;
}

From source file:Main.java

public static Date ConvertFromWebService(String strDate) {
    String[] formats = new String[] { "yyyy-MM-dd'T'HH:mm:ss.SSS", "yyyy-MM-dd'T'HH:mm:ss.SSSXXX",
            "yyyy-MM-dd'T'HH:mm:ss", "yyyy-MM-dd'T'HH:mm", "yyyy-MM-dd" };
    for (String frm : formats) {
        try {//www.jav a  2  s  . c  o m
            SimpleDateFormat format = new SimpleDateFormat(frm, Locale.US);
            format.setTimeZone(TimeZone.getTimeZone("UTC"));
            return format.parse(strDate);
        } catch (Exception ex) {
        }
    }
    return null;
}

From source file:Main.java

private static String createSymbolicateURL(String host) {
    return String.format(Locale.US, SYMBOLICATE_URL_FORMAT, host);
}

From source file:Main.java

private static String createPackagerStatusURL(String host) {
    return String.format(Locale.US, PACKAGER_STATUS_URL_FORMAT, host);
}

From source file:Main.java

private static String createResourceURL(String host, String resourcePath) {
    return String.format(Locale.US, RESOURCE_URL_FORMAT, host, resourcePath);
}

From source file:Main.java

private static String createOpenStackFrameURL(String host) {
    return String.format(Locale.US, OPEN_STACK_FRAME_URL_FORMAT, host);
}

From source file:Main.java

public static String getJobDateFormat(String strDate, String inputFormat) {
    String formatDate = "";
    String dayFormat[] = strDate.split("-");
    int day = Integer.parseInt(dayFormat[0]);
    try {//from w  w w  .  j  a  v  a2  s .c o  m
        String dayNumberSuffix = getDayNumberSuffix(day);
        SimpleDateFormat inputDateFormat = new SimpleDateFormat(inputFormat, Locale.US);
        Date date = inputDateFormat.parse(strDate);
        SimpleDateFormat outputDateFormat = new SimpleDateFormat(" d'" + dayNumberSuffix + "' MMMM yyyy",
                Locale.US);
        formatDate = outputDateFormat.format(date);
    } catch (ParseException e) {
        e.printStackTrace();
    }
    return formatDate;
}

From source file:Main.java

public static void stopCounter(String tag) {
    long stopTime = System.currentTimeMillis();
    if (listTimes.containsKey(tag)) {
        long startTime = listTimes.get(tag);
        long elapsedTime = stopTime - startTime;
        NumberFormat numberFormat = NumberFormat.getNumberInstance(Locale.US);
        System.out.println("#" + tag + "# {End counting :" + numberFormat.format(elapsedTime) + " ms }");
        listTimes.remove(tag);//w  w  w.  ja  v a  2 s. c o m
    } else
        Log.e(tag, "NO KEY IN HASHMAP To calculate Time");

}

From source file:Main.java

public static Date ConvertFromWebService(final String strDate) {

    final String[] formats = new String[] { "yyyy-MM-dd'T'HH:mm:ss.SSS", "yyyy-MM-dd'T'HH:mm:ss.SSSXXX",
            "yyyy-MM-dd'T'HH:mm:ss", "yyyy-MM-dd'T'HH:mm", "yyyy-MM-dd" };

    for (final String frm : formats) {
        try {/*from  w w w .  j  av a 2 s. c o m*/
            final SimpleDateFormat format = new SimpleDateFormat(frm, Locale.US);
            format.setTimeZone(TimeZone.getTimeZone("UTC"));
            return format.parse(strDate);
        } catch (final Exception ex) {
            Log.e("IGWHelper", "Failed to convert Web Service Date.", ex);
        }
    }
    return null;
}

From source file:Main.java

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