SkyRanger Posted April 13, 2007 Share Posted April 13, 2007 I am having a major brain fart..lol Trying to display previous month and cannot for the life of me, remember how to do it..lol I have date('F'); for this month but I can't remember how to get the previous month date('F'); - 1 Can somebody give me a hand please. Link to comment https://forums.phpfreaks.com/topic/46865-solved-date-question/ Share on other sites More sharing options...
kenrbnsn Posted April 13, 2007 Share Posted April 13, 2007 I would use the strtotime() function: <?php $mnth = date('F'); echo $mnth.'<br>'; $prev_mnth = date('F',strtotime("last month")); // "previous month" works also echo $prev_mnth; ?> Ken Link to comment https://forums.phpfreaks.com/topic/46865-solved-date-question/#findComment-228465 Share on other sites More sharing options...
SkyRanger Posted April 13, 2007 Author Share Posted April 13, 2007 Doh, thanks kenrbnsn Link to comment https://forums.phpfreaks.com/topic/46865-solved-date-question/#findComment-228466 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.