get next and previous day with PHP

后端 未结 11 772
悲哀的现实
悲哀的现实 2020-11-28 03:44

I have got two arrows set up, click for next day, next two days, soon and previous day, two days ago, soon. the code seem not working? as it only get one next and previous d

11条回答
  •  孤独总比滥情好
    2020-11-28 04:20

    You could use 'now' as string to get today's/tomorrow's/yesterday's date:

    $previousDay = date('Y-m-d', strtotime('now - 1day'));
    $toDay       = date('Y-m-d', strtotime('now'));
    $nextDay     = date('Y-m-d', strtotime('now + 1day'));
    

提交回复
热议问题