Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get day name from timestamp in MySQL

How do I get the day name from a timestamp datatype in MySQL?

2013-01-01 15:00:28 should return Tuesday

like image 629
nimrod Avatar asked Nov 28 '22 01:11

nimrod


2 Answers

SELECT DAYNAME('2013-01-01 10:10:10');
like image 58
Saharsh Shah Avatar answered Dec 04 '22 07:12

Saharsh Shah


Short day name example. This will return 'Tue':

SELECT DATE_FORMAT('2013-01-01 15:00:28','%a') as dayname;

Long day name example. This will return 'Tuesday':

SELECT DAYNAME('2013-01-01 15:00:28') as dayname;
like image 36
Bastion Avatar answered Dec 04 '22 08:12

Bastion