How to generate a timestamp with an absolute template

// Examples assume a current time of Saturday, 08/08/2026 07:08
$date1 = strtotime('2020-09-11'); // 1599796800 09/11/2020
$date2 = strtotime('9/11/2020'); // 1599796800 09/11/2020
$date3 = strtotime('Sep 11'); // 1789099200 09/11/2026
$date4 = strtotime('8:45 am'); // 1786193100 08:08 am
$date5 = strtotime('8am'); // 1786190400 08 am
$date6 = strtotime('2020-09-11 8:45 am'); // 1599828300 09/11/2020 08:09 am

How to generate a timestamp with a relative template

// Examples assume a current time of Saturday, 08/08/2026 07:08
$date1 = strtotime('+1 hour'); // 08:06 am
$date2 = strtotime('-2 days'); // 08/06/2026
$date3 = strtotime('tomorrow'); // 08/09/2026
$date4 = strtotime('tomorrow 10:15am'); // 08/09/2026 10:15 am
$date5 = strtotime('next sunday'); // 08/09/2026
$date6 = strtotime('last day of'); // 08/31/2026
$date7 = sttotime('first day of next month'); // 09/01/2026
$date8 = strtotime('third wednesday of'); // 08/19/2026
$date9 = strtotime('nov second thu of 8am'); // 11/12/2026 08:00 am

How to modify a timestamp

$checkout = mktime(13, 30, 0, 9, 8, 2017); // 1786190812 08/08/2026 08:08 am
$due_date = strtotime('+3 weeks 6pm', $checkout); // 1788040800 08/29/2026 06:08 pm

Back