At 12:16 1-4-03, you wrote:
how do you get just the month (in numeric format ) of a specific date. (not
today)
same for day and year.  The date is in yyyy-dd-mm format to start with.
thanks.
if you obtain it directly you should try to alter the way you get the date.

If it is from e.g. a database or something, you can choose:


$date="2003-04-01";


example 1:
$date_elements = explode ('-',$date);
echo "The date has exploded in a day {$date_elements[2]}, a month {$date_elements[1]} and the year{$date_elements[0]}.";


example 2:

echo 'The date is '     .substr($date, 8,2). '(day)'
                        .substr($date, 5,2). '(month)'
                        .substr($date, 0,4). '(year)';

(I'm not 100% sure about the 8 and the 5 )

Chris H.


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



Reply via email to