Example usage for java.util Locale getDefault

List of usage examples for java.util Locale getDefault

Introduction

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

Prototype

public static Locale getDefault() 

Source Link

Document

Gets the current value of the default locale for this instance of the Java Virtual Machine.

Usage

From source file:Main.java

public static String getFormartRefershTime() {
    SimpleDateFormat formart = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.getDefault());
    return formart.format(new Date());
}

From source file:Main.java

public static String calendarToShortDateBr(Calendar data) {
    SimpleDateFormat sdf = new SimpleDateFormat("MMM/yyyy", Locale.getDefault());
    return sdf.format(data.getTime());
}

From source file:Main.java

public static String getCurrentDateTime() {
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss", Locale.getDefault());
    Date date = new Date();
    return dateFormat.format(date);
}

From source file:Main.java

public static String millis2FormatString(String format, Long millis) {
    SimpleDateFormat sdf = new SimpleDateFormat(format, Locale.getDefault());
    return sdf.format(new Date(millis));
}

From source file:Main.java

public static String getDateTime(Date date) {
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS", Locale.getDefault());
    return dateFormat.format(date);
}

From source file:Main.java

public static Date getDate(String dateTime) {
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd", Locale.getDefault());
    Date date = null;/*from w  ww  . ja v  a  2 s  .c om*/
    try {
        date = dateFormat.parse(dateTime);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return date;
}

From source file:Main.java

public static String formatDailyTime(int dailyTime) {
    dailyTime = dailyTime / 1000 / 60;//from w  w  w.  j  a v  a2s. c o m
    int h = dailyTime / 60;
    int m = dailyTime % 60;
    return String.format(Locale.getDefault(), "%02d:%02d", h, m);
}

From source file:Main.java

public static String convertMillis(long millis) {
    return new SimpleDateFormat("\n[MM/dd/yyyy hh:mm:ss aaa] ", Locale.getDefault()).format(millis);

}

From source file:Main.java

public static String getDisplayDate(Date date, String pattern) {
    SimpleDateFormat formatter = new SimpleDateFormat(pattern, Locale.getDefault());
    return formatter.format(date);
}

From source file:Main.java

public static long getCurrentGmtTime(String format) {
    final SimpleDateFormat dateFormatGmt = new SimpleDateFormat(format, Locale.getDefault());
    dateFormatGmt.setTimeZone(TimeZone.getTimeZone("GMT"));
    return dateFormatGmt.getCalendar().getTimeInMillis();
}