Example usage for java.util Locale ENGLISH

List of usage examples for java.util Locale ENGLISH

Introduction

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

Prototype

Locale ENGLISH

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

Click Source Link

Document

Useful constant for language.

Usage

From source file:Main.java

public static String getCurrentDate() {
    Calendar cal = Calendar.getInstance(Locale.ENGLISH);
    SimpleDateFormat dateFormat1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    String txtcurrentDate = dateFormat1.format(cal.getTime());
    return txtcurrentDate;
}

From source file:Main.java

public static String getDate(String formate) {
    String str = new SimpleDateFormat(formate, Locale.ENGLISH).format(new Date());
    return str;//www .j  a v  a  2 s  .  co  m
}

From source file:Main.java

public static String sqlTime(Long dTime) {
    SimpleDateFormat sqlTime = new SimpleDateFormat("yy-MM-dd hh:mm:ss", Locale.ENGLISH); //For title display
    return sqlTime.format(dTime);
}

From source file:Main.java

public static float precision(int decimalPlace, float val) {
    if (Float.isNaN(val)) {
        return 0.0f;
    }//  w w w .ja v  a2s  . c  om

    String str = String.format(Locale.ENGLISH, "%." + decimalPlace + 'f', val);
    return Float.valueOf(str);

}

From source file:Main.java

public static String formatDate(Date date, String format) {
    SimpleDateFormat postFormater = new SimpleDateFormat(format, Locale.ENGLISH);

    String newDateStr = postFormater.format(date);
    return newDateStr;
}

From source file:Main.java

public static String getFormattedTime(String time) {
    SimpleDateFormat sdfDate = new SimpleDateFormat("dd-MM-yyyy HH:mm", Locale.ENGLISH);
    String strDate = null;/*from w  w w.j  a  va2s .  c om*/
    try {
        strDate = String.valueOf(sdfDate.parse(time));
    } catch (ParseException e) {
        e.printStackTrace();
        strDate = "";
    }
    return strDate;
}

From source file:Main.java

public static String formatTouchPoint(MotionEvent mv) {
    if (mv == null) {
        return "";
    }/*ww  w  .  jav  a 2  s .c o  m*/
    return String.format(Locale.ENGLISH, "x:%f, y:%f rawX:%f rawY: %f", mv.getX(), mv.getY(), mv.getRawX(),
            mv.getRawY());
}

From source file:Main.java

@SuppressLint("NewApi")
public static Locale getRootLocale() {
    if (android.os.Build.VERSION.SDK_INT < 9) {
        return Locale.ENGLISH;
    } else {/*from w  w w. j  a  v  a 2s. c  om*/
        return Locale.ROOT;
    }
}

From source file:Main.java

public static String formatFileSize(long size) {
    long kb = 1024;
    long mb = kb * 1024;
    float f = (float) size / mb;
    //Defect 2114236 modify by shaohuali@tcl.com begin
    return String.format(Locale.ENGLISH, "%.2f MB", f); // MODIFIED by junping.zhang, 2016-05-25,BUG-2167946
    //Defect 2114236 modify by shaohuali@tcl.com end
}

From source file:Main.java

public static String getDate(String integer) {
    SimpleDateFormat sdf = new SimpleDateFormat("EEEE,MMMM d,yyyy h:mm,a", Locale.ENGLISH);
    sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
    String formattedDate = sdf.format(new Date());
    if (!integer.equalsIgnoreCase("null")) {
        long seconds = Integer.valueOf(integer);
        long millis = seconds * 1000;
        Date date = new Date(millis);
        formattedDate = sdf.format(date);
        return formattedDate;
    }// w  ww. j ava  2  s.  c  om
    return formattedDate;

}