Unix Timestamp Conversion PHP - Invalid Date
I'm trying to do something incredibly simple - convert a timestamp to a string in php using the date () function.
The code looks like this:
$test = date('d/m/y','1407974400000');
echo $test;
I expect the answer to be 14/8/14.
If I check http://www.epochconverter.com/ that also gives this answer.
However, the output obtained from the above PHP is
07/12/86
I'm sure I'm doing something completely stupid here - anyone can help?
Thank,
Chris
+3
Chris hykin
source
to share
2 answers
You had 3 more zeros, use seconds instead of seconds:
$test = date('d/m/y','1407974400');
echo $test;
+2
Ende neu
source
to share
You should use "seconds", not "milliseconds" in the date function as a timestamp.
$test = date('d/m/y','1407974400');
echo $test;
0
Volkan Ulukut
source
to share