datetime - how to use epoch time in php by adding time offset value
I have this hex
2a ba ce 21 which I have converted to decimal
716885537, now what I have asked to do is:
2a ba ce 21 is given; now print last updated time in seconds (seconds that have elapsed since January 1 Midnight, 2000) - 4 Byte
For converting to standard epoch time, add time offset value 946684800 (time offset from Jan. 1970 to Jan. 2000)
I have searched alot and to be honest every thing got mixed... It would be great help if some one tell me how to do this in PHP.
Trying to unmix the things…
Presumably your hex bytes are in little-endian order, so you have to reverse before converting.
The conversion goes just like above. If you want to join the milliseconds to the timestamp, add them divided by 1000 to it.