Reputation: 24635
I get Integer timestamp from PHP program, but in Java timestamps are ing Long format. So how can I convert this PHP Integer timestamp to Java Long format and convert that long format to Date object?
Upvotes: 1
Views: 1590
Reputation: 4410
PHP timestamp is number of seconds since 1/1/1970, and Java timestamp is number of milliseconds since 1/1/1970. So all you need to do in Java is multiply it by 1000.
Date d=new Date((long)phpTimeStamp*1000);
Upvotes: 1