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 MMDDYYYYFormat(Date date) {
    return new SimpleDateFormat("MM/dd/yyyy").format(date);
}

From source file:Main.java

public static SimpleDateFormat getDateFormatWY() {
    SimpleDateFormat formatter = new SimpleDateFormat("dd MMM-yy");
    return formatter;
}

From source file:Main.java

public static String convertTime2Date(long longtime) {
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    String str = sdf.format(longtime);
    return str;// w  ww.jav  a  2 s. co  m
}

From source file:Main.java

public static String getSanShengDate(long time) {
    SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
    String dateString = formatter.format(time);
    return dateString;
}

From source file:Main.java

public static String getDateYMD(Date inputDate) {
    return new SimpleDateFormat("yyyy-MM-dd").format(inputDate);
}

From source file:Main.java

public static String getSanShengTime(long time) {
    SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    String dateString = formatter.format(time);
    return dateString;
}

From source file:Main.java

public static String timeStampToStr(long timeStamp) {
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    String date = sdf.format(timeStamp * 1000);
    return date;//from   w  w w  . ja  va  2s  . c  o  m
}

From source file:Main.java

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

From source file:Main.java

private static String toNYR(long data) {
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-M-d");
    try {/*  w  ww  .java2s .c  o m*/
        return dateFormat.format(data);
    } catch (Exception e) {
        return "";
    }
}

From source file:Main.java

public static String timeStampToTime(long timeStamp) {
    SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
    String date = sdf.format(timeStamp * 1000);
    return date;/*from   w  ww. j  a v a  2 s  .  c  om*/
}