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 getToday() {
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
    return dateFormat.format(new Date());
}

From source file:Main.java

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

From source file:Main.java

public static String day(Date now) {
    SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd");
    String strDate = sdfDate.format(now);
    return strDate;
}

From source file:Main.java

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

From source file:Main.java

private static String mCurrentTime() {
    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    String currenttime = df.format(new Date());
    return currenttime;
}

From source file:Main.java

public static String getSimpleMonthString(String curmills) {
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMM");
    long timeSta = Long.valueOf(curmills);
    return dateFormat.format(timeSta);
}

From source file:Main.java

public static String getTodayDate() {
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
    String date = sdf.format(new Date());
    return date;//ww w .ja va  2  s .  c o m
}

From source file:Main.java

public static String getCurrentTime() {
    SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
    String currentDateAndTime = sdf.format(new Date());
    return currentDateAndTime;
}

From source file:Main.java

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

From source file:Main.java

public static String getTodayDate() {
    SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
    Date date = new Date(System.currentTimeMillis());
    return sdf.format(date);
}