Re: date to string

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, February 1, 2007 6:30 pm, John Taylor-Johnston wrote:
> How do I take "2007-02-01" and turn it into Thursday, February 1,
> 2006?
> Simple question, except I don't know the answer :)
> This is all I see for now:
> http://ca.php.net/manual/en/function.px-date2string.php

list($year, $month, $day) = explode('-', '2007-02-01');
//the - 1 is because you SAID you wanted 2006..
//If that's a typo, lose the - 1 part.
$time = mktime(1, 0, 0, $month, $day, $year - 1);
echo date('l, F d', $time);

http://php.net/mktime
http://php.net/date

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux