| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| Senior Member Join Date: Apr 2005 Location: Australia
Posts: 1,092
![]() ![]() ![]() | 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 Join Date: Jan 2005 Location: Milwaukee, WI
Posts: 305
![]() ![]() | This will work for you: Code: <?php
$date = date("dmY", time()-86400);
?> Code: <?php
$date = date("dmY", time()-(60*60*24));
?> |
| |