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) 

Source Link

Document

Constructs a SimpleDateFormat using the given pattern and the default date format symbols for the default java.util.Locale.Category#FORMAT FORMAT locale.

Usage

From source file:Main.java

public static String currentDate() {
    SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy/MM/dd");
    return DATE_FORMAT.format(new Date());
}

From source file:Main.java

public static String getDateSuffix() {
    SimpleDateFormat formatter = new SimpleDateFormat("-yyyy-MM-dd-HH-mm-ss");
    Date curDate = new Date(System.currentTimeMillis());
    return formatter.format(curDate);
}

From source file:Main.java

public static String getTimeString(long time, String pattern) {
    return new SimpleDateFormat(pattern).format(new Date(time));
}

From source file:Main.java

public static String dateToString(Date data, String formatType) {
    return new SimpleDateFormat(formatType).format(data);
}

From source file:Main.java

public static String getCurrentTime() {
    SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    Date curDate = new Date(System.currentTimeMillis());
    return formatter.format(curDate);
}

From source file:Main.java

public static String getCurrentDate() {
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
    Date d = new Date();
    String currentdate = sdf.format(d);

    return currentdate;

}

From source file:Main.java

public static String getDataTimeString() {
    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    String datetime = format.format(new Date(System.currentTimeMillis()));
    return datetime;
}

From source file:Main.java

public static String getFileName() {
    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss_SS");
    String fileName = format.format(new Timestamp(System.currentTimeMillis()));
    return fileName;
}

From source file:Main.java

public static String DateToString(Date date) {
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
    String str = sdf.format(date);
    return str;//  w  w  w .  j a  va  2s  .  co  m
}

From source file:Main.java

public static String getCurrentDate() {
    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
    String currentDate = format.format(new Date());
    return currentDate;
}