I Have a string that is equal to a date, represented as the number of milliseconds since the Unix epoch.
I am trying to output it into d-m-Y.
The string I was given was ‘1227643821310’, and I am told that the result should be equal to 2-12-2008, but I keep getting a result of 25-11-2008
My code is as follows:
$mil = 1227643821310; $seconds = $mil / 1000; echo date('d-m-Y', $seconds);
Any ideas as to why this might be?
You are already doing it right, 1227643821 is simply not 02-12-2008, it is indeed 25-11-2008.