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 month(Date now) {
    SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM");
    String strDate = sdfDate.format(now);
    return strDate;
}

From source file:Main.java

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

From source file:Main.java

public static String getCurrentDate() {
    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
    return df.format(Calendar.getInstance().getTime());
}

From source file:Main.java

public static String formatSystemTime() {
    SimpleDateFormat format = new SimpleDateFormat("HH:mm:ss");
    return format.format(new Date());
}

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

public static String getCurrentTime() {

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

From source file:Main.java

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

From source file:Main.java

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