Funzioni per date e tempo

Le informazioni fornite sono server side

time()

Restituisce il tempo corrente come numero di secondi passati dal January 1 1970 00:00:00 GMT, Unix Epoch.

getdate()

Restituisce un array associativo contenente tutte le informazioni sulla data attuale.
Si accede con le chiavi

seconds 0..59
minutes 0..59
hours 0..23
mday 1..31
mon 1..12
year yyyy
wday 0..6
weekday Sunday..Saturday
month January..December
0 come time()

localtime()

Restituisce un array con indice numerico contenente le informazioni sulla data attuale nello stile della funzione C.
Se si passano i parametri (localtime(), true) restituisce un array associativo e si accede con le chiavi

tm_sec 0..59
tm_min 0..59
tm_hour 0..23
tm_mday 1..31
tm_mon 0..11
tm_year anni passati dal 1900
tm_wday 0..6
tm_yday giorno dell’anno
tm_isdst Daylight saving time, ora legale?

date()

Formatta una data secondo le informazioni restituite dalla funzione time() oppure secondo la data passata.

I caratteri disponibili sono

d 01..31 (2 cifre) Giorno del mese
j 1..31
N 1..7 Giorno della settimana
w 0..6
D Mon..Sun (3 caratteri)
l Sunday..Saturday
m 01..12 Mese
n 1..12
M Jan..Dec
F January..December
Y yyyy Anno
y yy
L bisestile?
g 1..12 Ora
G 0..23
h 01..12
H 00..23
i 00..59 Minuti
s 00..59 Secondi
c Formattazioni particolari…
r

checkdate()

Con parametri 1..12, 1..31, 1..32767 restituisce true se la data corrispondente è corretta.


Ancora…

mktime()
microtime()
date_sunrise()
date_sunset()
gmdate()
gmmktime()
gmstrftime()
Greenwich Mean Time (GMT)
gettimeofday()