How can i convert a Javascript timestamp in JSON to java timestamp?
Json timestamp Example: 1365427692
How can i convert a Javascript timestamp in JSON to java timestamp?
Json timestamp Example: 1365427692
private Date JSONTarihConvert(String tarih) throws ParseException{
long timestamp = getTimeStampFromTarih(tarih);
return new Date(timestamp);
}
More info here
The modern way is with java.time classes.
Instant instant = Instant.ofEpochSecond( 1365427692L );
An Instant
is a moment on the timeline in UTC with a resolution of nanoseconds.