PHP mktime() Funktion
Beispiel
Gibt den Unix-Zeitstempel für ein Datum zurück. Verwenden Sie es dann, um den Tag dieses Datums zu finden:
<?php
// Prints: October 3, 1975 was on a Friday
echo "Oct 3, 1975 was on a ".date("l", mktime(0,0,0,10,3,1975));
?>
Definition und Verwendung
Die Funktion mktime() gibt den Unix-Zeitstempel für ein Datum zurück.
Tipp: Diese Funktion ist identisch mit gmmktime() , außer dass die übergebenen Parameter ein Datum darstellen (kein GMT-Datum).
Syntax
mktime(hour, minute, second, month, day, year, is_dst)
Parameterwerte
Parameter | Description |
---|---|
hour | Optional. Specifies the hour |
minute | Optional. Specifies the minute |
second | Optional. Specifies the second |
month | Optional. Specifies the month |
day | Optional. Specifies the day |
year | Optional. Specifies the year |
is_dst | Optional. Set this parameter to 1 if the time is during daylight savings time (DST), 0 if it is not, or -1 (the default) if it is unknown. If it's unknown, PHP tries to find out itself (which may cause unexpected results). Note: This parameter is removed in PHP 7.0. The new timezone handling features should be used instead |
Technische Details
Rückgabewert: | Gibt einen ganzzahligen Unix-Zeitstempel zurück. FALSE bei Fehler |
---|---|
PHP-Version: | 4+ |
PHP-Änderungsprotokoll: | PHP 7.1: Der Parameter is_dst
wurde entfernt. PHP 5.3.0: Löst E_DEPRECATED aus, wenn der is_dst- Parameter verwendet wird PHP 5.1: Der is_dst- Parameter war veraltet. Wenn mktime() ohne Argumente aufgerufen wird, wirft es jetzt eine E_STRICT-Meldung. Verwenden Sie stattdessen die Funktion time(). |
❮ PHP-Datums-/Zeitreferenz