- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to get day name from timestamp in MySQL?
To get the day name from timestamp, use dayname() function −
select dayname(yourColumnName) from yourTableName; Let us first create a table : mysql> create table DemoTable ( LoginDate timestamp ); Query OK, 0 rows affected (0.52 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable values('2019-06-01'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable values('2019-06-02'); Query OK, 1 row affected (0.09 sec) mysql> insert into DemoTable values('2019-06-03'); Query OK, 1 row affected (0.09 sec) mysql> insert into DemoTable values('2019-06-04'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable values('2018-06-21'); Query OK, 1 row affected (0.09 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable;
Output
+-----------------------+ | LoginDate | +-----------------------+ | 2019-06-01 00 :00 :00 | | 2019-06-02 00 :00 :00 | | 2019-06-03 00 :00 :00 | | 2019-06-04 00 :00 :00 | | 2018-06-21 00 :00 :00 | +-----------------------+ 5 rows in set (0.00 sec)
Following is the query to get day name from timestamp in MySQL −
mysql> select dayname(LoginDate) from DemoTable;
Output
+--------------------+ | dayname(LoginDate) | +--------------------+ | Saturday | | Sunday | | Monday | | Tuesday | | Thursday | +--------------------+ 5 rows in set (0.00 sec)
- Related Articles
- How to get timestamp using MySQL?
- Extract the Day / Month / Year from a Timestamp in PHP MySQL?
- How to get beginning of the first day of this week from timestamp in Android sqlite?
- How to convert from Unix timestamp to MySQL timestamp value?
- Get day name for the corresponding date in MySQL?
- How to select date from timestamp in MySQL?
- How to get yesterday records from timestamp in Android sqlite?
- Get localized day name in Java
- How to get field name types from a MySQL database?
- Java Program to get full day name
- Get all MySQL records from the previous day (yesterday)?
- Fetching rows updated at timestamp older than 1 day in MySQL?
- How to get the previous day with MySQL CURDATE()?
- Get only the date in timestamp in MySQL?
- How to get a timestamp in JavaScript?

Advertisements