Page 1 of 1

Quick date function question

Posted: Mon Apr 09, 2007 12:03 pm
by seodevhead
Hey guys...

If..

Code: Select all

echo date('d');
# Outputs 'Mon'
How can I do the same for 3 days ago (Fri)? I can't seem to figure out how I can say to php, output the 3 letter abbreviation for the day that took place 3 days ago. Any guidance is appreciated. Thanks!

Posted: Mon Apr 09, 2007 12:06 pm
by feyd

Posted: Mon Apr 09, 2007 12:25 pm
by seodevhead
feyd wrote:date() + strtotime()
Hey feyd, I'm looking at strtotime() right now and am a little confused. It doesn't seem to show any output for the examples on the manual, but I gather it just takes the current or supplied timestamp and performs adjustments on that based on the first parameter in the function.

I am trying:

Code: Select all

$dayAbbrev = date('D') + strtotime("-1 day");
But it isn't working. Any further hints on where I'm going wrong here? Thanks feyd.

Posted: Mon Apr 09, 2007 12:32 pm
by RobertGonzalez

Code: Select all

<?php
echo date('d', strtotime('-3 days'));
?>

Posted: Mon Apr 09, 2007 12:57 pm
by seodevhead
May God Bless both Everah and feyd for their help and kindness :)

Posted: Mon Apr 09, 2007 1:30 pm
by RobertGonzalez
He has. And you are welcome.