php - One Hour Earlier Than Given Datetime

前端 未结 5 547
不思量自难忘°
不思量自难忘° 2020-12-20 14:16

I\'m having a problem here..

Supposed I have this kind of datetime.


$date = strtotime($date);

I need this to be converted into t

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-20 14:57

    You could do:

    
    $testDateStr = strtotime($date);
    $finalDate = date("Y-m-d H:i:s", strtotime("-1 hour", $testDateStr));
    
    

    Hope it helps

提交回复
热议问题