Given a time, how can I find the time one month ago

后端 未结 7 1462
梦如初夏
梦如初夏 2021-01-13 08:16

Given a time, how can I find the time one month ago.

相关标签:
7条回答
  • 2021-01-13 08:50
    <?php
    
    $date = new DateTime("18-July-2008 16:30:30");
    echo $date->format("d-m-Y H:i:s").'<br />';
    
    date_sub($date, new DateInterval("P1M"));
    echo '<br />'.$date->format("d-m-Y").' : 1 Month';
    
    ?> 
    
    0 讨论(0)
提交回复
热议问题