Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

time

Description

The time of Date / Time for PHP return current Unix timestamp.

Syntax

time(): int

Return

Returns the current time measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).

Examples

1 · void

<?

$return = time();

echo $return;

?>
1713104214

2

<?

$return = time();

$second = 1;
$minute = $second * 60;
$hour = $minute * 60;
$day = $hour * 24;
$week = $day * 7;
$month = $day * 30;
$year = $day * 365;

$format = "Y-m-d H:i:s";

echo date($format, $return) . " now". PHP_EOL;
echo date($format, $return + $second) . " next second" . PHP_EOL;
echo date($format, $return + $minute) . " next minute" . PHP_EOL;
echo date($format, $return + $hour) . " next hour" . PHP_EOL;
echo date($format, $return + $day) . " next day" . PHP_EOL;
echo date($format, $return + $week) . " next week" . PHP_EOL;
echo date($format, $return + $month) . " next month" . PHP_EOL;
echo date($format, $return + $year) . " next year";

?>
2024-04-14 14:16:54 now
2024-04-14 14:16:55 next second
2024-04-14 14:17:54 next minute
2024-04-14 15:16:54 next hour
2024-04-15 14:16:54 next day
2024-04-21 14:16:54 next week
2024-05-14 14:16:54 next month
2025-04-14 14:16:54 next year
HomeMenu