Example usage for java.util Locale CHINA

List of usage examples for java.util Locale CHINA

Introduction

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

Prototype

Locale CHINA

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

Click Source Link

Document

Useful constant for country.

Usage

From source file:Main.java

public static String getToday() {
    SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd", Locale.CHINA);
    return sdf.format(new Date());
}

From source file:Main.java

static void checkAngle(int angle) {
    if (angle < 0 || angle > 360) {
        throw new IllegalArgumentException(
                String.format(Locale.CHINA, "Illegal angle %d: must be >=0 and <= 360", angle));
    }//from   w ww  .j a  va 2 s . c om
}

From source file:Main.java

public static String getDay(long time) {
    DateFormat dateFormat = new SimpleDateFormat("dd", Locale.CHINA);
    return dateFormat.format(time);
}

From source file:Main.java

public static boolean isToday(Date date) {
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd", Locale.CHINA);
    return sdf.format(date).equals(sdf.format(new Date()));
}

From source file:Main.java

public static String getMonth(long time) {
    DateFormat dateFormat = new SimpleDateFormat("MM", Locale.CHINA);
    return dateFormat.format(time);
}

From source file:Main.java

public static String getYear(long time) {
    DateFormat dateFormat = new SimpleDateFormat("yyyy", Locale.CHINA);
    return dateFormat.format(time);
}

From source file:Main.java

public static String getCurrentDate() {
    SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd", Locale.CHINA);
    Date curDate = new Date(System.currentTimeMillis());
    return formatter.format(curDate);
}

From source file:Main.java

public static String formatDate(Date date) {
    SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd", Locale.CHINA);
    return formatter.format(date);
}

From source file:Main.java

public static String getTime(String pattern) {
    SimpleDateFormat dateFormat = new SimpleDateFormat(pattern, Locale.CHINA);
    return dateFormat.format(new Date());
}

From source file:Main.java

public static String timeDate(long time) {
    SimpleDateFormat sdr = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.CHINA);
    return sdr.format(new Date(time));
}