denoteone Posted April 17, 2009 Share Posted April 17, 2009 if I use $today= date("d"); I actually want the day before so I have to subtract one. ( I know this would not work if it is the 1st.) can any one help me with this $today= date("d"); $daybefore = $today - 1; Quote Link to comment https://forums.phpfreaks.com/topic/154546-solved-get-day-minus-1-day/ Share on other sites More sharing options...
laffin Posted April 17, 2009 Share Posted April 17, 2009 did u look at strtotime? Echo "Yesterday was: ". date("m/d/y",strtotime("-1 day")); Quote Link to comment https://forums.phpfreaks.com/topic/154546-solved-get-day-minus-1-day/#findComment-812604 Share on other sites More sharing options...
kenrbnsn Posted April 17, 2009 Share Posted April 17, 2009 You can also use words like "yesterday": <?php echo 'Yesterday was: ' . date('Y-m-d',strtotime('yesterday')); ?> Ken Quote Link to comment https://forums.phpfreaks.com/topic/154546-solved-get-day-minus-1-day/#findComment-812646 Share on other sites More sharing options...
keeB Posted April 17, 2009 Share Posted April 17, 2009 http://us3.php.net/strtotime fyi Quote Link to comment https://forums.phpfreaks.com/topic/154546-solved-get-day-minus-1-day/#findComment-812649 Share on other sites More sharing options...
laffin Posted April 17, 2009 Share Posted April 17, 2009 LOL Its good to learn new things Quote Link to comment https://forums.phpfreaks.com/topic/154546-solved-get-day-minus-1-day/#findComment-812661 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.