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 DateFormat GetDateFormatter() {
    SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
    //df.setTimeZone(TimeZone.getTimeZone("UTC"));
    return df;/*  w  w  w.ja v  a2s.  c  o  m*/
}

From source file:Main.java

public static String getRealData(String data) {
    SimpleDateFormat sdf5 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    Date d = new Date(Long.valueOf(data));
    return sdf5.format(d);
}

From source file:Main.java

public static String getShowTimeString(long time) {
    SimpleDateFormat format = new SimpleDateFormat("HH:mm");
    return format.format(new Date(time));
}

From source file:Main.java

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

From source file:Main.java

public static String setTimeDate(long time) {
    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
    String timeDate = format.format(new Date(time));
    return timeDate;
}

From source file:Main.java

public static String getCurrentTimeWithoutLine() {
    SimpleDateFormat df1 = new SimpleDateFormat("yyyyMMddHHmmss");
    Date t = new Date();
    return df1.format(t);
}

From source file:Main.java

static public String readableDateTime(Date time) {
    SimpleDateFormat format = new SimpleDateFormat("MMM dd,yyyy - HH:mm");
    String formatted = format.format(time);
    return formatted;
}

From source file:Main.java

public static String getUTCTimeStamp() {

    SimpleDateFormat iso8601Format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    String newDate = iso8601Format.format(new Date());
    return newDate;
}

From source file:Main.java

public static String normalDateFormat(Date date) {
    SimpleDateFormat format = new SimpleDateFormat("MMMM dd, yyyy");
    return format.format(date);
}

From source file:Main.java

public static String DateToStr(Date date) {

    SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
    String str = format.format(date);
    return str;//w ww .  j  a  va2  s. c  o  m
}