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());
      }
============================================================

Comments

Popular posts from this blog

Struts 2 : Warning :No configuration found for the specified action: 'Login.action' in namespace: '/'

Upload csv file at Google Cloud Storage using java

Read Images from a xlsx file using Apache POI