The mktime Function
The mktime
function converts a given
date into timestamp format. The timestamp format
is the number of seconds that have passed since 1
st
January 1970
up to the given point
in time.
Syntax
mktime(int $hour, ?int $minute = null, ?int $second = null, ?int $month = null, ?int $day = null, ?int $year = null): int|false
Example
Let's get the difference in seconds between
1970
and 31.12.2025
, 12:59:59
:
<?php
echo mktime(12, 59, 59, 12, 31, 2025);
?>
Code execution result:
1815386399