GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   quick php date() help (https://gfy.com/showthread.php?t=348082)

BradM 08-28-2004 04:51 PM

quick php date() help
 
You'll see what I am trying to go... hopefully lol


$yesterday = date(("F")+(("d")-1)+("Y"));

I am trying to minus 1 from the d, so I get "yesterday". How can I do this? I am probably making it too difficult. :p

Arty 08-28-2004 04:55 PM

Quote:

Originally posted by BradM
You'll see what I am trying to go... hopefully lol


$yesterday = date(("F")+(("d")-1)+("Y"));

I am trying to minus 1 from the d, so I get "yesterday". How can I do this? I am probably making it too difficult. :p

$yesterday = date("F d Y",mktime(0,0,0,date("F"),date("d")-1,date("Y")));

Fukeneh 08-28-2004 04:56 PM

isnt there already a flag for yesterday in php?

patch 08-28-2004 04:57 PM

$yesterday = date("F d Y", time()-86400);

BradM 08-28-2004 04:57 PM

Quote:

Originally posted by Arty
$yesterday = date("F d Y",mktime(0,0,0,date("F"),date("d")-1,date("Y")));
I tried that dude, the output I get is: December 27 2003

REALLY weird hey?

BradM 08-28-2004 04:58 PM

Quote:

Originally posted by patch
$yesterday = date("F d Y", time()-86400);
Cheers patch, much appreciated!

Arty 08-28-2004 04:58 PM

Sorry Correction,

$yesterday = date("F d Y",mktime(0,0,0,date("m"),date("d")-1,date("Y")));

:glugglug

fuzebox 08-28-2004 05:06 PM

This thread is hilarious :1orglaugh

Cheers to patch for an answer that makes sense.

BradM 08-28-2004 05:12 PM

Quote:

Originally posted by fuzebox
This thread is hilarious :1orglaugh

Cheers to patch for an answer that makes sense.

Fuzebox is a c-unt

Intrigue 08-28-2004 05:15 PM

hey dude, just use strtotime("-1 day");

patch 08-28-2004 05:25 PM

Quote:

Originally posted by Intrigue
hey dude, just use strtotime("-1 day");
My eyes prefer "-86400" to "- 1 day" :eyecrazy

And the full line is shorter that way....

JSA Matt 08-28-2004 05:33 PM

date("F d Y", strtotime("yesterday"));
date("F d Y", strtotime("-1 day"));

should have plenty of ways to do it lol.. I prefer the mktime method

KC 08-28-2004 05:43 PM

You guys are crazy.

Yesterday was the 28th.

Arty 08-28-2004 05:48 PM

Quote:

Originally posted by patch
My eyes prefer "-86400" to "- 1 day" :eyecrazy

And the full line is shorter that way....

It's not only shorter but also faster than other solutions, especially than the strtotime solution :thumbsup


All times are GMT -7. The time now is 09:09 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123