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. Quote 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 Quote 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 Quote Link to comment https://forums.phpfreaks.com/topic/46865-solved-date-question/#findComment-228466 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.