RE: Date

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

 



Don't forget that in cases like the one below, you can use the list() function to tighten things up a bit:

$start_date='2007-06-20';
list($start_year, $start_month, $start_day) = explode('-',$start_date);



I prefer using the date functions that some of the other people mentioned and only use the string functions to get date info when I have to.

If you use strtotime() or have the date in a serial format already, you can get a lot more than just month, day, year out of it using date().  But if all you really need is month, day, year then whichever method is easiest to work with.

-TG



= = = Original message = = =

$start_date='2007-06-20';
$parts=explode('-',$start_date);
$start_year = $parts[0];
$start_month = $parts[1];
$start_day = $parts[2];


___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

-- 
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