How to use timestamps (Part 1)
');
$thisFormat = "date('Y-m-d', $now)";
echo("$thisFormat; // " . date('Y-m-d', $now) . "
");
$expires = mktime(13, 30, 03, 15, 2018);
$thisFormat = "date('Y-m-d', $expires)";
echo("$thisFormat;
" . 'mktime(13, 30, 03, 15, 2018); // $expires' . " = " . date('Y-m-d', $expires) . "
");
$expires = mktime(13, 30, 03, 15);
$thisFormat = "date('Y-m-d', $expires)";
echo("$thisFormat;
" . 'mktime(13, 30, 03, 15); // $expires' . " = " . date('Y-m-d', $expires) . "
");
$expires = mktime(13, 30, 03);
$thisFormat = "date('Y-m-d', $expires)";
echo("$thisFormat;
" . 'mktime(13, 30, 03); // $expires' . " = " . date('Y-m-d', $expires) . "
");
?>
How to get the parts of a timestamp
$expires = mktime(13, 30, 0, 3, 15, 2018);
$parts = getdate($expires);
$year = $parts['year'];
$mon = $parts['mon'];
$month = $parts['month'];
$weekday = $parts['weekday'];
$mday = $parts['mday'];
$wday = $parts['wday'];
$hours = $parts['hours'];
$minutes = $parts['minutes'];
$seconds = $parts['seconds'];
Back