Funzione PHP mktime()
Esempio
Restituisci il timestamp Unix per una data. Quindi usalo per trovare il giorno di quella data:
<?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));
?>
Definizione e utilizzo
La funzione mktime() restituisce il timestamp Unix per una data.
Suggerimento: questa funzione è identica a gmmktime() eccetto che i parametri passati rappresentano una data (non una data GMT).
Sintassi
mktime(hour, minute, second, month, day, year, is_dst)
Valori dei parametri
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 |
Dettagli tecnici
Valore di ritorno: | Restituisce un timestamp Unix intero. FALSO in caso di errore |
---|---|
Versione PHP: | 4+ |
Registro delle modifiche PHP: | PHP 7.1: il parametro is_dst
è stato rimosso. PHP 5.3.0: Emette E_DEPRECATED se viene utilizzato il parametro is_dst PHP 5.1: Il parametro is_dst è stato deprecato. Se mktime() viene chiamato senza argomenti, ora genera un avviso E_STRICT. Utilizzare invece la funzione time(). |
❮ Riferimento di data/ora PHP