- 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 add time in minutes in datetime string PHP?
For this, you can use the strtotime() method.
The syntax is as follows −
$anyVariableName= strtotime('anyDateValue + X minute');
You can put the integer value in place of X.
Example
The PHP code is as follows
<!DOCTYPE html> <html> <body> <?php $addingFiveMinutes= strtotime('2020-10-30 10:10:20 + 5 minute'); echo date('Y-m-d H:i:s', $addingFiveMinutes); ?> </body> </html>
Output
This will produce the following output
2020-10-30 10:15:20
- Related Articles
- How to add 30 minutes to datetime in MySQL?
- How to add time in a MySQL column set with type DATETIME?
- Can we add minutes to VARCHAR datetime records while applying INSERT statement in MySQL?
- Add DATE and TIME fields to get DATETIME field in MySQL?
- How to convert a datetime string to millisecond UNIX time stamp?
- Add time to string data/time - JavaScript?
- Add10 minutes to MySQL datetime format?
- Java Program to add minutes to current time using Calendar.add() method
- How to part DATE and TIME from DATETIME in MySQL?
- How to add a day to datetime field in MySQL query?
- MySQL Datetime to add days?
- How to convert timestamp string to datetime object in Python?
- MySQL query to get only the minutes from datetime?
- How to convert JS date time to MySQL datetime?
- Convert number INT in minutes to TIME in MySQL?

Advertisements