Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

convert json date to java date

DateTimeFormatter jsonDateFormatter = new DateTimeFormatterBuilder()
            .appendLiteral("/Date(")
            .appendValue(ChronoField.INSTANT_SECONDS)
            .appendValue(ChronoField.MILLI_OF_SECOND, 3)
            .appendLiteral(")/")
            .toFormatter();

    String createdOn = "/Date(1406192939581)/";
    Instant created = jsonDateFormatter.parse(createdOn, Instant::from);
    System.out.println("Created on " + created);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #convert #json #date #java #date
ADD COMMENT
Topic
Name
4+3 =