- Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.30, 8.2.0 - 8.2.25, 8.3.0 - 8.3.13
- 2020-01-26 08:00
<?php
$fromDate = '26-1-2020';
$fromHours = '09';
$fromMins = '00';
$subtractHours = '1'; // don't bother with 3600 precalculation
$subtractMins = '0';
$format = 'Y-m-d H:i:s';
$date = DateTime::createFromFormat('d-m-Y H:i:s', "{$fromDate} {$fromHours}:{$fromMins}:00");
$date->sub(new DateInterval("PT{$subtractHours}H{$subtractMins}M"));
echo $date->format('Y-m-d H:i');