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.

Post New Thread Reply

Register GFY Rules Calendar Mark Forums Read
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 04-04-2010, 10:20 AM   #1
xxweekxx
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
xxweekxx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-04-2010, 10:25 AM   #2
ottopottomouse
She is ugly, bad luck.
 
ottopottomouse's Avatar
 
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
ottopottomouse is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-04-2010, 10:33 AM   #3
xxweekxx
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
xxweekxx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-04-2010, 02:39 PM   #4
natkejs
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...
__________________
natkejs is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-04-2010, 03:29 PM   #5
Brujah
Beer Money Baron
 
Brujah's Avatar
 
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'));
__________________
Brujah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-05-2010, 02:55 AM   #6
natkejs
Confirmed User
 
Industry Role:
Join Date: Jan 2003
Location: Nomad Land
Posts: 1,629
Quote:
Originally Posted by Brujah View Post
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'));
very neat, never used it like that
__________________
natkejs is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks
Thread Tools



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.