PHP - Time
Trieda
Metóda - Time
The time() function is used to get the current time in the UNIX
timestamp format, the number of seconds since 1/1/1970.
Procedurálne
- function Time () : void
Parametre
ŽiadneMávratovej hodnoty
Returns a whole number (the number of seconds since 1/1/1970).
Príklady
$currentTime = time();
$timeYesterday = $currentTime - (24 * 60 * 60); // currentTime - (hours * minutes * seconds)
$timeNextWeek = $currentTime + (7 * 24 * 60 * 60); // currentTime + (days * hours * minutes * seconds)
$time128DaysAgo = $currentTime - (128 * 24 * 60 * 60); // currentTime - (days * hours * minutes * seconds)
echo '128 days ago: ' . date('G:i:s d.m.Y', $time128DaysAgo) . '<br>';
echo 'Yesterday: ' . date('G:i:s d.m.Y', $timeYesterday) . '<br>';
echo 'Today: ' . date('G:i:s d.m.Y', $currentTime) . '<br>';
echo 'Next week: ' . date('G:i:s d.m.Y', $timeNextWeek);
