on 01/04/03 9:16 PM, Diana Castillo ([EMAIL PROTECTED]) 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 your date was yyyy-mm-dd, you could do this:

<?
$date = '2002-03-18';
echo date('m', strtotime($date));
?>

But, because yours isn't:

<?
$date = '2002-03-18';
list($y,$d,$m) = explode('-',$date);
echo date('m', strtotime("{$y}-{$m}-{$d}"));
?>

Justin


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

Reply via email to