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

Read Images from a xlsx file using Apache POI

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

How to create mail message in FRC822 format