Just use strtotime
function of php.
for example:
$twoHoursAgo = Date("Y-m-d H:i:s", strtotime("-2 hours"));
for more refer below link Get the timestamp of exactly one week ago in PHP?
More Related Contents:
- how to write php code for the key press enter button when fill the form?
- How to update multiple MySQL table entries with different id?
- PHP – Change value y,n in database [closed]
- I can’t view the database content on a php page [closed]
- How chnage image size before uploaded on server [closed]
- Undefined function mysql_connect()
- “Connect failed: Access denied for user ‘root’@’localhost’ (using password: YES)” from php function [duplicate]
- mysqli::mysqli(): (HY000/2002): Can’t connect to local MySQL server through socket ‘MySQL’ (2)
- What is the difference between MySQL, MySQLi and PDO? [closed]
- Fatal error: [] operator not supported for strings
- Maximum execution time in phpMyadmin
- Can I use a PDO prepared statement to bind an identifier (a table or field name) or a syntax keyword?
- PHP PDO – Num Rows
- Post and get at the same time in php
- How to solve General error: 2006 MySQL server has gone away
- Setting up Laravel on a Mac php artisan migrate error: No such file or directory [duplicate]
- ini_set, set_time_limit, (max_execution_time) – not working
- What is the best way to insert multiple rows in PHP PDO MYSQL?
- access denied for user @ ‘localhost’ to database ” [closed]
- How can I employ “if exists” for creating or dropping an index in MySQL?
- adding 30 minutes to datetime php/mysql
- Create table with PHP and populate from MySQL
- How can I do a migration in laravel 5.5?
- Best way to store IP in database?
- Which is fastest in PHP- MySQL or MySQLi?
- SQL Query with binary data (PHP and MySQL)
- How to get last inserted id from table MySQL [duplicate]
- How can I list data in sections by an ID, with a while loop in PHP? [closed]
- Save array in mysql database
- find in set in laravel ? example