Home > MySQL: Visual QuickStart Guide (1st Edition) > Topic

MySql ( Day of Week Retrival )

Posted by mitch 
This forum is now read only. You can not log in or make any changes. Please use the new forum linked above.
As of March 14, 2011, this forum has been replaced and is permanently set to read-only mode. This means you can view any existing post but cannot open new posts or reply to existing ones. The new forum is located athttp://www.larryullman.com/forums/If you need to post a message, you'll need to register there. If you have to post in order to follow up on a thread started here, well, that's going to be a bit of a pain. I would recommend just posting the appropriate information, or copying the original text from here, or linking to your thread here. I apologize for the inconvenience but this purge will make for better forums in the long run. Thanks.
MySql ( Day of Week Retrival )
August 11, 2005 06:23AM
I have this date format 2005-08-02 in field _date. My question is how could i determine the day of week of the date given.

For example:

2005-08-09 --> Wednesday

How could i get the value of Wednesday?

Thanks in advance! U
Re: MySql ( Day of Week Retrival )
August 11, 2005 11:04AM
To get day of the week of a given date, use DATE_FORMAT.

Example: SELECT DATE_FORMAT('2005-08-09', '%W');

By the way, both August 02, 2005 and August 09, 2005 were Tuesday and not Wednesday.

Cheers.

Georgio
Re: MySql ( Day of Week Retrival )
August 12, 2005 04:22PM
Thanks Georgio!

I had found this solution:

SELECT DAYNAME('date') FROM tbl;


Just to share it to anyone.