![]() |
quick php date help..
<?php
echo date("m/d/y"); ?> that will echo current month/day/yr how do i make it echo YESTERDAYs info so instead of 04/06/10 it'l be 04/05/10 |
$yesterday=date("m/d/y", time()-86400);
carry on multiplying the seconds to get back more days |
so it'll be
<?php $yesterday=date("m/d/y", time()-86400); ?> |
or
<?php echo date("m/d/y",mktime(0,0,0,0,-1,0)); ?> that tells it to generate a date using todays date -1 day, so that would be yesterday. change -1 to -7 and it will be one week ago and so on and so forth... |
Take a look at strtotime also, if you prefer. You can do a lot with it like; +1 day, -1 day, last monday, next tuesday, etc...
http://www.php.net/manual/en/function.strtotime.php $yesterday = date('m/d/y', strtotime('-1 day')); |
Quote:
|
All times are GMT -7. The time now is 03:00 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123