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 numberFormat(Double number) {
    DecimalFormat format = (DecimalFormat) DecimalFormat.getInstance(Locale.getDefault());
    return format.format(number);
}

From source file:Main.java

public static String apodDateQueryString(Date date) {
    return new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()).format(date);
}

From source file:Main.java

/**
 * Returns the device language settings
 */
public static String getLocaleLanguage() {
    return Locale.getDefault().getDisplayLanguage();
}

From source file:Main.java

public static String formatDateYearFirst(Date date) {
    return new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()).format(date);
}

From source file:Main.java

public static Long GetUTCTime() {
    Calendar cal = Calendar.getInstance(TimeZone.getDefault(), Locale.getDefault());
    int zoneOffset = cal.get(Calendar.ZONE_OFFSET);
    int dstOffset = cal.get(Calendar.DST_OFFSET);
    cal.add(java.util.Calendar.MILLISECOND, -(zoneOffset + dstOffset));
    return cal.getTimeInMillis();
}

From source file:Main.java

/**
 * //w  ww  .  j  a  v a2  s. c o  m
 * @param heading
 * @return
 */
public static String correctConvertHeading(long heading) {
    String ret = String.format(Locale.getDefault(), "%03d", heading);
    if (ret.equals("000")) {
        ret = "360";
    }
    return ret;
}

From source file:Main.java

public static boolean isToday(Calendar cal) {

    Calendar today = Calendar.getInstance(Locale.getDefault());

    return cal.get(Calendar.DAY_OF_YEAR) == today.get(Calendar.DAY_OF_YEAR)
            && cal.get(Calendar.YEAR) == today.get(Calendar.YEAR);
}

From source file:Main.java

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

From source file:Main.java

public static String formatData(String format, Object object) {
    try {/*from  w  w w.j  av a 2s  . c  om*/
        return new SimpleDateFormat(format, Locale.getDefault()).format(object);
    } catch (Exception e) {
        return "";
    }
}

From source file:Main.java

public static String format(long timeMillis, String pattern) {
    SimpleDateFormat dateFormat = new SimpleDateFormat(pattern, Locale.getDefault());
    return dateFormat.format(timeMillis);
}