The following example of idate() is used for formatting a local time or date as integer.
The following example of idate() is used for formatting a local time or date as integer.
The idate() function formats a local time or date as integer. It returns a default value of time, if no timestamp is given otherwise it returns number formatted according to the given format string using the given integer timestamp or the current local time.
idate functions similar to function date() but it accepts just one char in the format parameter.
Syntax or Code of idate() Function PHP
int idate ( string $format [, int $timestamp= time() ] )
Parameter & Description of idate() in PHP
format - Format is an essential parameter. It returns the result according to specified parameter.
timestamp - It is optional and returns the result in the formatted form if date or time is specified or it returns the default timestamp.
Example of idate() in PHP:
<?php
echo(idate("Y"));
?>
The output of the code above could be:
2006