Forum Moderators: coopster

Message Too Old, No Replies

Show Yesterday's Date

         

damlag

9:09 am on Dec 28, 2008 (gmt 0)

10+ Year Member



Hi guys,

I tried searching, but can't find anywhere.

How to show yesterday's date on the webpage with PHP in this format?

"December 27, 2008"

Anyone could help out?

janharders

12:21 pm on Dec 28, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



[php.net...]
will get you the syntax ... it requires you to pass a timestamp as an argument - just use time() - 86400 (one day has 86400 seconds, so now - 86400 always results to the same time on the day before)

date ( "F d, Y", time() - 86400 )

should do the job

Habtom

12:26 pm on Dec 28, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



... or simply date ("F d, Y", strtotime("yesterday"));

damlag

12:56 pm on Dec 28, 2008 (gmt 0)

10+ Year Member



Hey thanx Janharders,

I don't know any programming, but You sort of put it on the plate :-)

That worked like a charm.

Happy hols for all!

Cheers