PHP - Function idate()
int idate ( string $format [, int $timestamp] );
Definition and Usage
Returns a number formatted according to the given format string using the given integer timestamp or the current local time if no timestamp is given. In other words, timestamp is optional and defaults to the value of time().
|format||Required. Specifies how to return the result:
|timestamp||Optional. This is an integer Unix timestamp that defaults to the current local time if a timestamp is not given. In other words, it defaults to the value of time().|
Always returns an integer and as they can't start with a "0", idate() may return fewer digits than you would expect.
Following is the usage of this function:
<?php $timestamp = strtotime('1st January 2004'); echo idate('y', $timestamp); echo"\n"; echo idate('t', $timestamp); ?>
This will produce following result: