Question

date from database

2013-10-26T10:31:20GMT+05:30

UI Date

 Mon Feb 10 00:00:00 GMT+05:30 2014

need to convert according to Database Date

Was it helpful?

Solution

Please try this

Date dNow = new Date( );
      SimpleDateFormat ft = 
      new SimpleDateFormat ("E yyyy.MM.dd 'at' hh:mm:ss a zzz");

ft.format(dNow);

Note: give your format to SimpleDateFormat ,it will then format as shown above.

OTHER TIPS

Use following code

    // This is how to get today's date in Java
    Date today = new Date();// use your date here
   //SimpleDateFormat example - Date with timezone information
    SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm  'GMT'Z '('z')'");
    String date = DATE_FORMAT.format(today);
    System.out.println("Today in yyyy-MM-dd'T'HH:mm  'GMT'Z '('z')' : " + date);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top