PHP time function issue
I need to add X days to the current time
echo date("d.m.Y H:i",time());
echo "<br>";
echo date("d.m.Y H:i",time()+5*24*60*60);
return correct results
18.10.2013 14:22
23.10.2013 14:22
but if I change 5 to 10, then
18.10.2013 14:22
28.10.2013 13:22
13:22 instead of 14:22 as a result. 1 hour missed.
What could be wrong with him?
+4
3 answers
Use the strtotime function :
Examples:
echo date("d.m.Y H:i",strtotime("+10 days")) ;
echo date("d.m.Y H:i",strtotime("+6 hours 30 seconds"))
The strtotime function ignores daylight saving time.
0