Name
idate
Synopsis
int idate(stringformat
[, inttimestamp
])
Formats a time and date as an integer according to the
format
string provided in the first
parameter. If the second parameter is not specified, the current time
and date is used. The following characters are recognized in the
format
string:
| Swatch Internet time |
| Day of the month |
| Hour in 12-hour format |
| Hour in 24-hour format |
| Minutes |
| 1 if Daylight Savings Time; 0 otherwise |
| Day of the month; e.g., 1 through 31 |
| 0 if the year is not a leap year; 1 if it is |
| Month (1 through 12) |
| Seconds |
| Number of days in the month, from 28 to 31 |
| Seconds since the Unix epoch |
| Numeric day of the week, starting with 0 for Sunday |
| Numeric week of the year according to ISO 8601 |
| Year with four digits; e.g., 1998 |
| Year with one or two digits; e.g., 98 |
| Day of the year, from 1 through 365 |
| Time zone offset in seconds, from −43200 (far west of UTC) to 43200 (far east of UTC) |
Any characters in the format
string
not matching one of the above are ignored. Although the character
strings used in idate
are similar
to those in date
, because idate
returns an integer, in places where
date
would return a two-digit number with leading
zero, the leading zero is not preserved; for example, date('y');
will return 05 for a timestamp in
2005, while idate('y');
will return
5.
Get Programming PHP, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.