![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
Join Date: Oct 2002
Posts: 6,780
|
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
__________________
_________________ I am the best ![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
She is ugly, bad luck.
Industry Role:
Join Date: Jan 2010
Posts: 13,177
|
$yesterday=date("m/d/y", time()-86400);
carry on multiplying the seconds to get back more days |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Confirmed User
Join Date: Oct 2002
Posts: 6,780
|
so it'll be
<?php $yesterday=date("m/d/y", time()-86400); ?>
__________________
_________________ I am the best ![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
Confirmed User
Industry Role:
Join Date: Jan 2003
Location: Nomad Land
Posts: 1,629
|
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...
__________________
![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 |
Beer Money Baron
Industry Role:
Join Date: Jan 2001
Location: brujah / gmail
Posts: 22,157
|
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'));
__________________
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 | |
Confirmed User
Industry Role:
Join Date: Jan 2003
Location: Nomad Land
Posts: 1,629
|
Quote:
![]()
__________________
![]() |
|
![]() |
![]() ![]() ![]() ![]() ![]() |