I have done this in Java:
Calendar lCDateTime = Calendar.getInstance();
date = lCDateTime.getTimeInMillis();
I have done this in PHP:
$date = date(U);
In Java, it is working. In PHP it doesn’t.
In Java I get: 1358789604926
In PHP I get: 1358790190 (a smaller number)
Can anyone explain the difference between the two results?
The timestamp generated by Java is in miliseconds, while the timestamp generated by PHP is in seconds. So in order to compare the two, you just need to “drop” the last three digits of the Java timestamp with division by 1000.