PHP | idate() Function Last Updated : 27 Aug, 2018 Comments Improve Suggest changes Like Article Like Report The idate() function is an inbuilt function in PHP which is used to format a local time/date as an integer. The $format and $timestamp are sent as parameters to the idate() function and it returns an integer formatted according to the specified format using the given timestamp. Unlike the function date(), idate() accepts just one char in the format parameter. Syntax: int idate( $format, $timestamp ) Parameters: This function accepts two parameters as mentioned above and described below: $format: It is a mandatory parameter which specifies the format of the result. The format parameter can have the following values: 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 if DST (daylight saving time) is activated, 0 otherwise L - returns 1 for leap year, 0 otherwise m - Month number s - Seconds t - Days in current month U - 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 year Z - Timezone offset in seconds $timestamp: It is an optional parameter which specifies a Unix timestamp that represents the date/time to be formatted. Return Value: It returns an integer value according to the specified format using the given timestamp. Exceptions: The idate() function throws a E_NOTICE on every call to a date/time if the time zone is not valid. The idate() function throws a E_STRICT or E_WARNING message if using the system settings or the TZ environment variable. Below programs illustrate the idate() function in PHP: Program 1: php <?php // Formatting local date/time as Year echo idate("Y") . "<br>"; // Formatting local date/time as Hour(24 hr format) echo idate("H") . "<br>"; // Formatting local date/time as Minutes echo idate("i") . "<br>"; // Formatting local date/time as day of the year echo idate("z") . "<br>"; ?> Output: 20181122238 Program 2: php <?php // Parsing English textual datetime description into a Unix timestamp $timestamp = strtotime('24th August 2018'); // Formatting local date/time as Year echo idate('Y', $timestamp); ?> Output: 2018 Related Articles: PHP | time() Function PHP | strptime() Function Reference: http://php.net/manual/en/function.idate.php Comment More infoAdvertise with us Next Article PHP | idate() Function S Shubrodeep Banerjee Follow Improve Article Tags : Misc Web Technologies PHP PHP-date-time PHP-function +1 More Practice Tags : Misc Similar Reads PHP | imageinterlace() Function The imageinterlace() function is an inbuilt function in PHP which is used to enable or disable interlace in an image. Interlacing (also known as interleaving) is a method of encoding a bitmap image such that a person who has partially received it sees a degraded copy of the entire image. One differe 2 min read PHP | random_int() Function The random_int () is an inbuilt function in PHP. The main function is to generate cryptographically secure pseudo-random integers value. When unbiased results occur in critical condition, then generated cryptographic random integers are used.The different sources of randomness used in this function 2 min read PHP | IntlChar istitle() Function The IntlChar::istitle function is an inbuilt function in PHP which is used to check whether the input character code point is a titlecase letter or not. In True cases, the characters with the general category are "Lt" (titlecase letter).Syntax: bool IntlChar::istitle( $codepoint ) Parameters: This f 2 min read PHP linkinfo() Function The linkinfo() function is an inbuilt function in PHP that retrieves information related to the links. This function checks the link is pointed to by the path that exists. Syntax: linkinfo(string $path)Parameter: This function accepts one parameter that is described below: $path: Â This parameter spe 1 min read PHP | IntlChar::isIDPart() Function The IntlChar::isIDPart() function is an inbuilt function in PHP which is used to check whether the given input character is permissible in an identifier or not. It is True for characters with general category "L" (Letters), "Nd" (Decimal digits), "Nl" (letters numbers), "Mc" and "Mn"(Combining marks 2 min read Like