Reputation: 43
I need to add X days to 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 in result. 1 hour is missed.
What can be with it?
Upvotes: 4
Views: 148
Reputation: 1371
Use 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"))
strtotime function ignores the transition to winter time.
Upvotes: 0
Reputation: 1554
Daylight savings ends on the 27th of October (so we fall back an hour) which explains the issue you are seeing. Try it with another month and you will get the expected result!
Upvotes: 1