looking at the manual, getdate() is meant to be passed a unix time stamp,
so, you'll need to use strtotime() first thus:
$utime = strtotime("30-Nov-1971");
$dob = getdate($utime);
$dobnum = $dob['yday'];
print $dobnum;
Notice I changed the format of the date, when I tried using the original
format, strtotime() complained, saying it couldn't convert it.
Martin T
-----Original Message-----
From: sundogcurt [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 14, 2001 7:57 AM
To: GENERAL PHP LIST
Subject: [PHP] take date and convert to day of year
Hi guys, I know that you can take todays date and display it as the
numeric day of the year, 1 - 365 / 0 - 364 etc.
But can you take a date such as (November-30-1971) and convert that to
the numeric day of the year?
I have been trying to do this but have had no joy, I don't think my code
is even close.
$dob = getdate("Nov-30-1971");
$dobnum = $dob['yday'];
print $dobnum;
$dob 'should' be an array and 'yday' should be the numeric value for the
day of the year, right?!?
This is what I am trying, and how I understand it, using 'yday' should
give you basically the same output as date ("z");
What I would like is the ability to convert any date to the days numeric
value. Any help would be GREATLY appreciated.
(C:
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]