RE: [PHP] Date
| From: | tg-php at gryffyndevelopment dot com | Date: | Wed, 20 Jun 2007 14:47:11 +0000 |
| Subject: | RE: [PHP] Date | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-257494@lists.php.net to get a copy of this message | ||
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.