Adding days to a timestamp

后端 未结 7 1254
春和景丽
春和景丽 2021-02-05 07:59

Giving a starting date, I\'m adding four times seven days to get 5 different dates separated exactly a week each one.

//$date = \'28-10-2010\';
$timestamp = mkti         


        
相关标签:
7条回答
  • 2021-02-05 08:38

    I believe this does have something to do with daylight savings time because the 'time' segment of your timestamp is set to midnight on the dot, but when daylight savings finishes we go back an hour - which is still the previous day (at 11pm).

    If you add 2 hours to the original line so you have this:

    $timestamp = mktime( 2, 0, 0, 10, 01, 2010 );
    

    and therefore start at 2am rather than midnight... it works.

    0 讨论(0)
提交回复
热议问题