date('dmY H:i', $timestamp);
How to deduct for example 3 hours?
if you have $ timestamp in UNIX format, then there is no place to be easier
$timestamp-3*60*60
time
$time = time() - 3 * 60 * 60; // секунды echo date('dmY H:i', $time);
strtotime
$time = strtotime('-3 hours'); echo date('dmY H:i', $time);
Datetime
$date = new \DateTime('-3 hours'); echo $date->format('dmY H:i');
Source: https://ru.stackoverflow.com/questions/179395/
All Articles