PHP idate() function

P
PHP gmstrftime() Function
PHP localtime() function

What is the syntax of the idate() function in PHP?

idate(format, timestamp)
ParameterDescription
formatRequired. Specifies how to return the result. One of the following characters is allowed:B – Swatch Beat/Internet Timed – Day of the monthh – Hour (12 hour format)H – Hour (24 hour format)i – MinutesI – returns 1 if DST (daylight saving time) is activated, 0 otherwiseL – returns 1 for leap year, 0 otherwisem – Month numbers – Secondst – Days in current monthU – Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)w – Day of the week (Sunday=0)W – ISO-8601 week number of year (week starts on Monday)y – Year (1 or 2 digits)Y – Year (4 digits)z – Day of the yearZ – Timezone offset in seconds

Examples of the idate() function

Example 1. In this example,

<?php
echo idate("B") . "<br>";
echo idate("d") . "<br>";
echo idate("h") . "<br>";
echo idate("H") . "<br>";
echo idate("i") . "<br>";
echo idate("I") . "<br>";
echo idate("L") . "<br>";
echo idate("m") . "<br>";
echo idate("s") . "<br>";
echo idate("t") . "<br>";
echo idate("U") . "<br>";
echo idate("w") . "<br>";
echo idate("W") . "<br>";
echo idate("y") . "<br>";
echo idate("Y") . "<br>";
echo idate("z") . "<br>";
echo idate("Z") . "<br>";
?>
PHP gmstrftime() Function
PHP localtime() function

Add comment

Tutor Network

Share this

Learn PHP from A to Z