Forum Moderators: coopster

Message Too Old, No Replies

Convert Date Into day

         

fib_81

12:04 am on May 13, 2005 (gmt 0)

10+ Year Member



Hi,

I posted a question about session variables and appended variable value to a url and I figured it. Thanks for those who helped.

Now, I have question about converting date into actual name of day. For example, converting
2005-05-12 to thursday. Is there a way to do that?

Thanks,
Fib_81

Gibisan

1:01 am on May 13, 2005 (gmt 0)

10+ Year Member



You can use the php date function.
date("D") will give you a three letter day - 'Thu' today.

If you are not using a date that is todays date you can use mktime()

Using your date of 2005-05-12:
echo date("l", mktime(0, 0, 0, 5, 12, 2005));
you'd get 'Thursday'.

coopster

12:05 am on May 14, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Right on, Gibisan, and welcome to WebmasterWorld. There is also PHP's getdate() [php.net] function.