Date Format(yyyy-MM-dd HH:mm:ss) in java

 Date Format(yyyy-MM-dd HH:mm:ss) in java
 ============================================================
public static String getCurrentTimeStamp(){
        String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
        SimpleDateFormat sdf =
              new SimpleDateFormat(DATE_FORMAT);
        Calendar c1 = Calendar.getInstance(); // current date and time by system
        System.out.println("Today is " + sdf.format(c1.getTime()));
        return sdf.format(c1.getTime());
      }
============================================================

Popular posts from this blog

Android: where to run keytool command in android

Can not connect to git using ssh (Permissions 0644 for '/root/.ssh/id_rsa' are too open.

Upload file on Google cloud storage using Java servlet on google app engine