date & time
|
MySQL: datetime!
filemtime($file)
fileatime($file)
|
- <? date($format, $time)?>
- <? gmdate($format, $time)?>
- <? time()?>
$time � un intero pari al # di secondi dall'era Unix (1/1/1970); se $time non � indicato, viene assunto ora;
se $time � errato, verr� restituita la data 31/12/1969.
$format � una stringa usata per visualizzare i componenti:
- Y - year, 4 digits; i.e. "1999"
- y - y - year, 2 digits; i.e. "99"
- M - month, textual, 3 letters; i.e. "Jan"
- F - Month, textual, long; i.e. "January"
- m - month; i.e. "01" to "12"
- n - month without leading zeros; i.e. "1" to "12"
- D - day of the week, textual, 3 letters; i.e. "Fri"
- l (lowercase 'L') - day of the week, textual, long; i.e. "Friday"
- d - day of the month, 2 digits with leading zeros; i.e. "01" to "31"
- j - day of the month without leading zeros; i.e. "1" to "31"
- w - day of the week, numeric, i.e. "0" (Sunday) to "6" (Saturday)
- t - number of days in the given month; i.e. "28" to "31"
- L - boolean for whether it is a leap year; i.e. "0" or "1"
- I (capital i) - "1" if Daylight Savings Time, "0" otherwise.
- z - day of the year; i.e. "0" to "365"
- S - English ordinal suffix, textual, 2 characters; i.e. "th", "nd"
- H - hour, 24-hour format; i.e. "00" to "23"
- h - hour, 12-hour format; i.e. "01" to "12"
- G - hour, 24-hour format without leading zeros; i.e. "0" to "23"
- g - hour, 12-hour format without leading zeros; i.e. "1" to "12"
- i - minutes; i.e. "00" to "59"
- s - seconds; i.e. "00" to "59"
- A - AM o PM
- a - am o pm
- T - Timezone setting of this machine; i.e. "MDT"
- Z - timezone offset in seconds (i.e. "-43200" to "43200")
- U - Seconds since UNIX epoch eg. 960206903
- B - Swatch Internet time
Esempi:
<?echo date("D M d, Y H:i:s")?>
<?echo date("D d M Y H:i:s")?>
<?echo date("d/m/Y H:i:s")?>
e inoltre:
<?print(date("l F d, Y")); ?>
gmdate() � identica, ma usa il GMT
(Greenwich Mean Time) invece dell'ora locale.
time() restituisce l'ora locale in secondi dall'era UNIX, quindi equivale a date("U").
ATTENZIONE!
MySQL usa la funzione datetime e non date!
|