Example usage for java.text SimpleDateFormat format

List of usage examples for java.text SimpleDateFormat format

Introduction

In this page you can find the example usage for java.text SimpleDateFormat format.

Prototype

public final String format(Date date) 

Source Link

Document

Formats a Date into a date-time string.

Usage

From source file:Main.java

public static String getCurrentlyDate() {
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
    return dateFormat.format(new Date());
}

From source file:Main.java

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

From source file:Main.java

public static String getDateTime(String time) {
    String paramFormat = "yyyy-MM-dd";
    SimpleDateFormat sdf = new SimpleDateFormat(paramFormat);
    return sdf.format(time).toString();
}

From source file:Main.java

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

From source file:Main.java

public static String formatDataYYYYMMDD(long time) {
    Date date = new Date(time * 1000);
    SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
    return formatter.format(date);
}

From source file:Main.java

public static String getFormatedDateTime(long dateTime) {
    SimpleDateFormat sDateFormat = new SimpleDateFormat("yyyy-MM-dd");
    return sDateFormat.format(new Date(dateTime * 1000));
}

From source file:Main.java

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

From source file:Main.java

public static String getTodaysTime(String format) {
    SimpleDateFormat formater = new SimpleDateFormat(format);
    return formater.format(new Date());
}

From source file:Main.java

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

From source file:Main.java

public static String dateToString(Date date, String dateFormat) {
    SimpleDateFormat formatter = new SimpleDateFormat(dateFormat);
    return formatter.format(date);
}