Cheers Andy, between my last post and this one I came up with a rather
long-winded way of doing it...
$dayarray = getdate(mktime(0,0,0,$month,$date,$year));
switch ($dayarray["wday"]) {
case 0:
$day = "Sunday";
break;
case 1:
$day = "Monday";
break;
case 2:
$day = "Tuesday";
break;
case 3:
$day = "Wednesday";
break;
case 4:
$day = "Thursday";
break;
case 5:
$day = "Friday";
break;
case 6:
$day = "Saturday";
break;
}
Ugh. I'll try your method.
Cheers
Jon
-----Original Message-----
From: Andrew Rush [mailto:[EMAIL PROTECTED]]
Sent: 16 January 2001 16:03
To: Jon Haworth
Subject: Re: [PHP] Working out the name of the day given a date
On Tuesday, January 16, 2001, at 10:56 AM, Jon Haworth wrote:
> Just a quickie. Does anyone have a code snippet for calculating the day of
> the week given a date? I was hoping I could feed a string like "20010116"
to
> a function and have it return "Tuesday" - it doesn't have to be exactly
this
> date format that is used for the input, but I do need the name of the day
on
> the output!
covert your date string to a unix timestamp and then use date("l",
$myString)
have a great day,
andy
:: Andrew Rush :: Lead Systems Developer :: MaineToday.com ::
**************************************************************************
"Crippled but free, blind all the time, i was learning to see"
- J. Garcia / R. Hunter
**************************************************************************
The views expressed herein are not necessarily those of my employer, but
they let me have them anyway.
--
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]