Example usage for java.text SimpleDateFormat SimpleDateFormat

List of usage examples for java.text SimpleDateFormat SimpleDateFormat

Introduction

In this page you can find the example usage for java.text SimpleDateFormat SimpleDateFormat.

Prototype

public SimpleDateFormat(String pattern, DateFormatSymbols formatSymbols) 

Source Link

Document

Constructs a SimpleDateFormat using the given pattern and date format symbols.

Usage

From source file:Main.java

public static SimpleDateFormat getDateFormat() {
    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.US);
    format.setTimeZone(TimeZone.getTimeZone("UTC"));
    return format;
}

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 String dateToString(Date date) {
    return new SimpleDateFormat("dd.MM.yyyy", Locale.getDefault()).format(date);
}

From source file:Main.java

public static String formatTime(long lefttime) {
    SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss", Locale.CHINA);
    String sDateTime = sdf.format(lefttime);
    return sDateTime;
}

From source file:Main.java

public static String FormatDateTimePrecise(Date d) {
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSSZ", java.util.Locale.getDefault());
    return sdf.format(d);
}

From source file:Main.java

static String currentDate() {
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd", Locale.US);
    return sdf.format(new Date());
}

From source file:Main.java

public static int formatYear(long lefttime) {
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy", Locale.CHINA);
    String sDateTime = sdf.format(lefttime);
    int i = Integer.parseInt(sDateTime);
    return i;//from  w w w.j  a  v a  2  s . c o  m
}

From source file:Main.java

public static int formatMonth(long lefttime) {
    SimpleDateFormat sdf = new SimpleDateFormat("MM", Locale.CHINA);
    String sDateTime = sdf.format(lefttime);
    int i = Integer.parseInt(sDateTime);
    return i;//from w ww.j a va  2 s  . com
}