O'Reilly logo

Programming PHP, 3rd Edition by Peter MacIntyre, Kevin Tatroe, Rasmus Lerdorf

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

idate

Synopsis

int idate(string format[, int timestamp])

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:

B

Swatch Internet time

d

Day of the month

h

Hour in 12-hour format

H

Hour in 24-hour format

i

Minutes

I

1 if Daylight Savings Time; 0 otherwise

j

Day of the month; e.g., 1 through 31

L

0 if the year is not a leap year; 1 if it is

m

Month (1 through 12)

s

Seconds

t

Number of days in the month, from 28 to 31

U

Seconds since the Unix epoch

w

Numeric day of the week, starting with 0 for Sunday

W

Numeric week of the year according to ISO 8601

Y

Year with four digits; e.g., 1998

y

Year with one or two digits; e.g., 98

z

Day of the year, from 1 through 365

Z

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.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required