w3resource

PHP: idate() function

Description

The idate() function is used to get a local time/date format as an integer.

Version:

(PHP 4 and above)

Syntax:

idate(format, timestamp) 

Parameters:

Name Description Required /
Optional
Type
format B - Swatch Beat/Internet Time
d - Day of the month
h - Hour (12-hour format)
H - Hour (24-hour format)
i - Minutes
I - returns 1 when DST is activated otherwise 0
L - returns 1 for leap year otherwise 0
m - Month number
s - Seconds
t - Days in current month
U - Seconds since the Unix Epoch - January 1 1970 00:00:00 UTC
w - Day of the week (0 on Sunday)
W - ISO-8601 numeric week of year, weeks starting on Monday
y - Year
Y - Year in 4 digits
z - Day of the year
Z - Timezone offset in seconds

Optional String
timestamp An integer indicates the unixtimestamp. If a timestamp is not supplied, it gives the current local time. Optional integer

Return value:

An integer value.

Value Type: Integer.

Example:

<?php
echo idate('d');
?> 

Sample Output:

19

View the example in the browser

See also

PHP Function Reference

Previous: gmstrftime
Next: localtime



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://www.w3resource.com/php/function-reference/idate.php