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; 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")); 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 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 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 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
Archived
This topic is now archived and is closed to further replies.