Search code examples
javadate-conversion

Java date format conversion


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


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.