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 getMID() {
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmms");
    return dateFormat.format(System.currentTimeMillis());
}

From source file:Main.java

public static boolean isValidDate(String inDate) {
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
    dateFormat.setLenient(false);//w w  w.  j av a 2  s  .c  o  m
    try {
        dateFormat.parse(inDate.trim());
    } catch (ParseException pe) {
        return false;
    }
    return true;
}

From source file:Main.java

public static String getDate() {
    return new SimpleDateFormat("HH:mm, dd MMM yyyy").format(new Date());
}

From source file:Main.java

public static String getPath() {
    return new SimpleDateFormat("yyyyMMddHHmmss").format(Calendar.getInstance().getTime()).trim() + ".jpg";
}

From source file:Main.java

private static String getDate() {
    return new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss").format(Calendar.getInstance().getTime());
}

From source file:Main.java

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

From source file:Main.java

public static String formatHHmm(long ms) {
    SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
    return sdf.format(ms);
}

From source file:Main.java

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

From source file:Main.java

public static String getTimeViaMiliseconds(long miliseconds) {
    return new SimpleDateFormat("yyyy-MM-dd HH:mm").format(miliseconds * 1000);
}

From source file:Main.java

public static String getDateHM(long time) {
    SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
    String dt = sdf.format(time);
    return dt;//  w w w  . j a va 2 s . c  o m
}