datetime - how to use epoch time in php by adding time offset value
I have this hex2a ba ce 21
which I have converted to decimal716885537
, 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.
Answer
Solution:
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.