| |||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| Senior Member | How would I do this? Hello. Does anyone know how I would go about getting the date from the previous day in PHP? I can get the current days date using: $date = date("dmY"); (that is the format that I want it) though if i wanted yesturdays date, that would be harder to get becuase the days system isn't based on 100 (grr to whoever made the date system ). If anyone could help me that would be great (eg. If i tried 03112005 - 1 it would = 03112004 ) --- I tried: $yesturday = mktime(0, 0, 0, date("m") , date("d")-1, date("Y")); though that didn't work the way I wanted :'(
__________________ :bingo: :kickass: :lala: :notme: :great: :gn: |
| |
| | #2 (permalink) |
| NamePros Regular | This will work for you: Code: <?php
$date = date("dmY", time()-86400);
?>
Code: <?php
$date = date("dmY", time()-(60*60*24));
?>
__________________ Simple Script Scheduling from CronService.co.uk | ShadowWind Manor | HotTopics - A Great Community! | WebmasterFusion.com - Free Webmaster Tools and Resources! |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |