
- MySQL - Home
- MySQL - Introduction
- MySQL - Features
- MySQL - Versions
- MySQL - Variables
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Node.js Syntax
- MySQL - Java Syntax
- MySQL - Python Syntax
- MySQL - Connection
- MySQL - Workbench
- MySQL Databases
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Show Database
- MySQL - Copy Database
- MySQL - Database Export
- MySQL - Database Import
- MySQL - Database Info
- MySQL Users
- MySQL - Create Users
- MySQL - Drop Users
- MySQL - Show Users
- MySQL - Change Password
- MySQL - Grant Privileges
- MySQL - Show Privileges
- MySQL - Revoke Privileges
- MySQL - Lock User Account
- MySQL - Unlock User Account
- MySQL Tables
- MySQL - Create Tables
- MySQL - Show Tables
- MySQL - Alter Tables
- MySQL - Rename Tables
- MySQL - Clone Tables
- MySQL - Truncate Tables
- MySQL - Temporary Tables
- MySQL - Repair Tables
- MySQL - Describe Tables
- MySQL - Add/Delete Columns
- MySQL - Show Columns
- MySQL - Rename Columns
- MySQL - Table Locking
- MySQL - Drop Tables
- MySQL - Derived Tables
- MySQL Queries
- MySQL - Queries
- MySQL - Constraints
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Replace Query
- MySQL - Insert Ignore
- MySQL - Insert on Duplicate Key Update
- MySQL - Insert Into Select
- MySQL Indexes
- MySQL - Indexes
- MySQL - Create Index
- MySQL - Drop Index
- MySQL - Show Indexes
- MySQL - Unique Index
- MySQL - Clustered Index
- MySQL - Non-Clustered Index
- MySQL Operators and Clauses
- MySQL - Where Clause
- MySQL - Limit Clause
- MySQL - Distinct Clause
- MySQL - Order By Clause
- MySQL - Group By Clause
- MySQL - Having Clause
- MySQL - AND Operator
- MySQL - OR Operator
- MySQL - Like Operator
- MySQL - IN Operator
- MySQL - ANY Operator
- MySQL - EXISTS Operator
- MySQL - NOT Operator
- MySQL - NOT EQUAL Operator
- MySQL - IS NULL Operator
- MySQL - IS NOT NULL Operator
- MySQL - Between Operator
- MySQL - UNION Operator
- MySQL - UNION vs UNION ALL
- MySQL - MINUS Operator
- MySQL - INTERSECT Operator
- MySQL - INTERVAL Operator
- MySQL Joins
- MySQL - Using Joins
- MySQL - Inner Join
- MySQL - Left Join
- MySQL - Right Join
- MySQL - Cross Join
- MySQL - Full Join
- MySQL - Self Join
- MySQL - Delete Join
- MySQL - Update Join
- MySQL - Union vs Join
- MySQL Keys
- MySQL - Unique Key
- MySQL - Primary Key
- MySQL - Foreign Key
- MySQL - Composite Key
- MySQL - Alternate Key
- MySQL Triggers
- MySQL - Triggers
- MySQL - Create Trigger
- MySQL - Show Trigger
- MySQL - Drop Trigger
- MySQL - Before Insert Trigger
- MySQL - After Insert Trigger
- MySQL - Before Update Trigger
- MySQL - After Update Trigger
- MySQL - Before Delete Trigger
- MySQL - After Delete Trigger
- MySQL Data Types
- MySQL - Data Types
- MySQL - VARCHAR
- MySQL - BOOLEAN
- MySQL - ENUM
- MySQL - DECIMAL
- MySQL - INT
- MySQL - FLOAT
- MySQL - BIT
- MySQL - TINYINT
- MySQL - BLOB
- MySQL - SET
- MySQL Regular Expressions
- MySQL - Regular Expressions
- MySQL - RLIKE Operator
- MySQL - NOT LIKE Operator
- MySQL - NOT REGEXP Operator
- MySQL - regexp_instr() Function
- MySQL - regexp_like() Function
- MySQL - regexp_replace() Function
- MySQL - regexp_substr() Function
- MySQL Fulltext Search
- MySQL - Fulltext Search
- MySQL - Natural Language Fulltext Search
- MySQL - Boolean Fulltext Search
- MySQL - Query Expansion Fulltext Search
- MySQL - ngram Fulltext Parser
- MySQL Functions & Operators
- MySQL - Date and Time Functions
- MySQL - Arithmetic Operators
- MySQL - Numeric Functions
- MySQL - String Functions
- MySQL - Aggregate Functions
- MySQL Misc Concepts
- MySQL - NULL Values
- MySQL - Transactions
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - SubQuery
- MySQL - Comments
- MySQL - Check Constraints
- MySQL - Storage Engines
- MySQL - Export Table into CSV File
- MySQL - Import CSV File into Database
- MySQL - UUID
- MySQL - Common Table Expressions
- MySQL - On Delete Cascade
- MySQL - Upsert
- MySQL - Horizontal Partitioning
- MySQL - Vertical Partitioning
- MySQL - Cursor
- MySQL - Stored Functions
- MySQL - Signal
- MySQL - Resignal
- MySQL - Character Set
- MySQL - Collation
- MySQL - Wildcards
- MySQL - Alias
- MySQL - ROLLUP
- MySQL - Today Date
- MySQL - Literals
- MySQL - Stored Procedure
- MySQL - Explain
- MySQL - JSON
- MySQL - Standard Deviation
- MySQL - Find Duplicate Records
- MySQL - Delete Duplicate Records
- MySQL - Select Random Records
- MySQL - Show Processlist
- MySQL - Change Column Type
- MySQL - Reset Auto-Increment
- MySQL - Coalesce() Function
MySQL - Date and Time Functions
In MySQL, we have a set of functions using which we can manipulate the date and time values. Following are the MySQL date time functions −
Sr.No. | Name & Description |
---|---|
1 |
ADDDATE()
This function adds two given dates |
2 |
ADDTIME()
This function adds given time values |
3 |
CONVERT_TZ()
This function converts from one timezone to another |
4 |
CURDATE()
This function returns the current date |
5 |
CURRENT_DATE(), CURRENT_DATE
Synonyms for CURDATE() |
6 |
CURRENT_TIME(), CURRENT_TIME
Synonyms for CURTIME() |
7 |
CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP
Synonyms for NOW() |
8 |
CURTIME()
This function returns the current time |
9 |
DATE_ADD()
Adds two dates |
10 |
DATE_FORMAT()
This function formats the given date as specified |
11 |
DATE_SUB()
This function subtracts two dates |
12 |
DATE()
This function extracts the date part of a date or datetime expression |
13 |
DATEDIFF()
This function subtracts two dates |
14 |
DAY()
This function retrieves the day of the month from the given date |
15 |
DAYNAME()
This function returns the name of the weekday |
16 |
DAYOFMONTH()
This function returns the day of the month (1-31) |
17 |
DAYOFWEEK()
This function returns the weekday index of the argument |
18 |
DAYOFYEAR()
This function returns the day of the year (1-366) |
19 |
EXTRACT
This function extracts part of a date |
20 |
FROM_DAYS()
This function converts a day number to a date |
21 |
FROM_UNIXTIME()
This function formats date as a UNIX timestamp |
22 |
HOUR()
This function Extracts the hour |
23 |
LAST_DAY
This function returns the last day of the month for the argument |
24 |
LOCALTIME(), LOCALTIME
Synonym for NOW() |
25 |
LOCALTIMESTAMP, LOCALTIMESTAMP()
Synonym for NOW() |
26 |
MAKEDATE()
This function creates a date from the year and day of year |
27 |
MAKETIME()
This function creates a time value from the given hours, minutes, and seconds. |
28 |
MICROSECOND()
This function returns the microseconds from argument |
29 |
MINUTE()
This function returns the minute from the argument |
30 |
MONTH()
This function returns the month from the date passed |
31 |
MONTHNAME()
This function returns the name of the month |
32 |
NOW()
This function returns the current date and time |
33 |
PERIOD_ADD()
This function adds a period to a year-month |
34 |
PERIOD_DIFF()
This function returns the number of months between periods |
35 |
QUARTER()
This function returns the quarter from a date argument |
36 |
SEC_TO_TIME()
This function converts seconds to 'HH:MM:SS' format |
37 |
SECOND()
This function returns the second (0-59) |
38 |
STR_TO_DATE()
This function converts a string to a date |
39 |
SUBDATE()
This function subtracts the specified interval to a date value |
40 |
SUBTIME()
This function subtracts the specified time interval to a date time or, time value |
41 |
SYSDATE()
This function returns the time at which the function executes |
42 |
TIME_FORMAT()
This function formats the given date in the specified format |
43 |
TIME_TO_SEC()
This function returns the argument converted to seconds |
44 |
TIME()
This function extracts the time portion of the expression passed |
45 |
TIMEDIFF()
This function subtracts two time values |
46 |
TIMESTAMP()
With a single argument, this function returns the date or datetime expression. With two arguments, the sum of the arguments |
47 |
TIMESTAMPADD()
This function adds an interval to a datetime expression |
48 |
TIMESTAMPDIFF()
This function subtracts an interval from a datetime expression |
49 |
TO_DAYS()
This function returns the date argument converted to days |
50 |
UNIX_TIMESTAMP()
This function returns a UNIX timestamp |
51 |
UTC_DATE()
This function returns the current UTC date |
52 |
UTC_TIME()
This function returns the current UTC time |
53 |
UTC_TIMESTAMP()
This function returns the current UTC date and time |
54 |
WEEK()
This function returns the week number |
55 |
WEEKDAY()
This function returns the weekday index |
56 |
WEEKOFYEAR()
This function returns the calendar week of the date (1-53) |
57 |
YEAR()
This function returns the year |
58 |
YEARWEEK()
This function returns the year and week |
59 |
TO_SECONDS()
This function converts the date or date-time values into seconds and returns the result. |