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 getCurrentDate() {
    SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddhhmmss");
    return sdf.format(new Date());
}

From source file:Main.java

public static String getTimeHM(Date inputDate) {
    return new SimpleDateFormat("HH:mm").format(inputDate);
}

From source file:Main.java

public static String getPicName() {
    SimpleDateFormat fat = new SimpleDateFormat("yyyyMMdd_hhmmss");
    return fat.format(new Date()) + ".jpg";
}

From source file:Main.java

public static String time() {
    SimpleDateFormat format = new SimpleDateFormat("hh:mm:ss");
    Calendar c = Calendar.getInstance();
    String date = format.format(c.getTime());
    return date;/* w  w w  .ja  v  a 2  s . co  m*/
}

From source file:Main.java

public static String date() {
    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd-hh-mm-ss");
    Calendar c = Calendar.getInstance();
    String date = format.format(c.getTime());
    return date;// ww w .j a v  a  2s  .  com
}

From source file:Main.java

public static String date2() {
    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
    Calendar c = Calendar.getInstance();
    String date = format.format(c.getTime());
    return date;//  w w  w  . jav  a2  s .  c  o m
}

From source file:Main.java

public static String getDate() {
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
    return dateFormat.format(new Date(System.currentTimeMillis()));
}

From source file:Main.java

public static String format(Date date, String format) {
    return new SimpleDateFormat(format).format(date);
}

From source file:Main.java

public static String niceDate(Long date) {
    SimpleDateFormat ft = new SimpleDateFormat("E d MMM");
    return ft.format(new Date(date));
}

From source file:Main.java

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