
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
How to subtract 10 days from the current datetime in MySQL?
Firstly, let us get the current datetime with the help of the now() function.
mysql> select now();
The following is the output.
+---------------------+ | now() | +---------------------+ | 2018-11-01 19:55:56 | +---------------------+ 1 row in set (0.00 sec)
Syntax to subtract 10 days with the help of DATE_SUB()
select DATE_SUB(now(),interval integer_value day );
Applying the above syntax to subtract 10 days from the current datetime.
mysql> select DATE_SUB(now(),interval 10 day);
Here is the output.
+---------------------------------+ | DATE_SUB(now(),interval 10 day) | +---------------------------------+ | 2018-10-22 19:56:07 | +---------------------------------+ 1 row in set (0.00 sec)
- Related Articles
- How to subtract 30 days from the current datetime in MySQL?
- How to subtract 3 hours from a datetime in MySQL?
- Subtract days from current date using Calendar.DATE in Java
- C# DateTime to add days to the current date
- MySQL Datetime to add days?
- How to subtract days from a date in JavaScript?
- Fetch datetime row from exactly past 7 days records in MySQL
- Java Program to subtract 40 days from the calendar
- How to get the records of the last two days from the current date in MySQL?
- Is there a way to subtract number of days from a date in MySQL?
- MySQL query to get current datetime and only current date
- Insert current date in datetime format MySQL?
- Add 11 days to current date in MySQL
- How to subtract 1 hour from current time using Swift?
- MySQL DateTime Now()+5 days/hours/minutes/seconds?

Advertisements