Zer0 Zer0 - 6 months ago 14
Java Question

Java converting string, having millisecond to date object

I have 2 Strings

  • 2012-06-25 15:02:22.948

  • +0530

I need a new string which adds the 5:30 to the time in the first string.

I thought I can do this by converting both strings to date objects and then adding. But i dont know how to do it, as when i use

yyyy MM dd hh:mm:ss as the date format for the first string, I get an error.



You can merge both you string String1+string2 and can use format yyyy-MM-dd HH:mm:ss.SSSZ to parse the date. You can see more documentation here