Search code examples
javajava-7simpledateformatdate-formatdate

Java 7 DateFormat to parse UTC date to Local Date


Could you please let me know what should be the JDK 7 date format to parse the date 2019-06-18T19:04:30.515 UTC and change it to local date time?


Solution

  • Here you can find an interesting article about this subject:

    https://en.wikipedia.org/wiki/Coordinated_Universal_Time

    The explanation of the patterns can be found here:

    https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html#timezone

    This makes me suggest "yyyy-MM-dd'T'HH:mm:ss.SSS z" as pattern. I hope it helps you.