timestamp: java vs php

One of my project implies connection from java client to server via php script. Client sends some information with date, formatted in timestamp.
I convert this timestamp on server side to date and put it to DataBase. Silly problem was that timestamp in Java counts milliseconds from start of Unix epoch (1/1/1970), but PHP counts seconds.

So, solution is very simple:
convert milliseconds to seconds on server side.

$php_timestamp = round($java_timestamp/1000);

2 comments

Leave a Reply

%d bloggers like this: