Convert string to timestamp for java date

Asked

Viewed 235 times

0

How to convert string to timestamp generated by php with the time() method generated for example : 1504541885 for Date in java

1 answer

2


It is possible to do this:

Integer timeStamp = Integer.Parse("1504541885");
Date time = new Date((long) timeStamp * 1000);
  1. Documentation of java.util.Date
  • ta generating Sun Jan 18 06:55:41 BRT 1970. that’s not it. time in php generates the current timestamp

  • @Paulorogerio See the second option

Browser other questions tagged

You are not signed in. Login or sign up in order to post.