I would like to create a timestamp by a variable of hour.
for example: current timestamp is:
2015-09-29 14:00:00
my variable is : $hour = 2
new timestamp that I want:
2015-09-29 16:00:00
I would like to create a timestamp by a variable of hour.
for example: current timestamp is:
2015-09-29 14:00:00
my variable is : $hour = 2
new timestamp that I want:
2015-09-29 16:00:00
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?