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 getSystemTime() {
    return new SimpleDateFormat("HHmmss").format(new Date());
}

From source file:Main.java

public static String getDateTime() {
    SimpleDateFormat sDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    String date = sDateFormat.format(new java.util.Date());
    return date;/*w w  w.j  a  va  2 s .co  m*/
}

From source file:Main.java

public static String getCurrentDataTime() {
    return new SimpleDateFormat("yyyy_MM_dd_HH_mm_ss").format(new Date());
}

From source file:Main.java

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

From source file:Main.java

public static String getNowTimeString() {
    SimpleDateFormat sDateFormat = new SimpleDateFormat("yyyy-MM-dd_hhmmss");
    return sDateFormat.format(new java.util.Date());
}

From source file:Main.java

public static String getCurrentTime() {
    SimpleDateFormat sDateFormat = new SimpleDateFormat("yyyy-MM-dd-hh-mm-ss");
    String date = sDateFormat.format(new java.util.Date());
    return date;//ww  w  .j a  v a2  s  .  c om
}

From source file:Main.java

public static String GetSysTimeshort() {
    SimpleDateFormat sDateFormat = new SimpleDateFormat("yyyy-MM-dd");
    String date = sDateFormat.format(new java.util.Date());
    return date;//  w w  w . j  a v a  2s  .co  m
}

From source file:Main.java

public static String getTodaysDayOfWeek() {
    return new SimpleDateFormat("EEEE").format(new Date());
}

From source file:Main.java

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

From source file:Main.java

public static String getTimeFromMillis(long time) {

    String curStringTime = new SimpleDateFormat("HH:mm:ss").format(time);
    return curStringTime;
}