Hello,
I have a java file that write records to the DB and time stamps
I have another php file that reads that records..
unfortunately After converting the time stamp to dates I got a wrong dates ??
what is the problem !!!
Hello,
I have a java file that write records to the DB and time stamps
I have another php file that reads that records..
unfortunately After converting the time stamp to dates I got a wrong dates ??
what is the problem !!!
PHP uses the UNIX epoch, I suspect Java uses a different epoch.
EDIT: I was way off, turns out PHP uses seconds, java uses miliseconds. So multiply by 1000 or divide by 1000 depending on which way you're converting.
Java uses a timestamp which is milliseconds from the epoch. PHP uses the standard unix timestamp which is seconds from the epoch.
I believe both use the same epoch of Jan. 1, 1970 00:00:00 UTC
I think the problem is you're retrieving a DATETIME or TIMESTAMP column or such that has been stored and screwing up the conversion. Try this:
$phpdate = strtotime( $dateFromDb );
echo date("F j, Y, g:i a", $phpdate);