Copyright © tutorialspoint.com
| string strftime ( string $format [, int $timestamp] ); |
Returns a string formatted according to the given format string using the given timestamp or the current local time if no timestamp is given. Month and weekday names and other language dependent strings respect the current locale set with setlocale().
| Parameter | Description |
|---|---|
| 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(). |
Returns a string formatted according to the given format string using the given timestamp or the current local time if no timestamp is given.
Following is the usage of this function:
<?php
setlocale(LC_TIME, 'en_US');
echo strftime("%b %d %Y %H:%M:%S",
mktime(20, 0, 0, 12, 31, 2005)) . "\n";
echo gmstrftime("%b %d %Y %H:%M:%S",
mktime(20, 0, 0, 12, 31, 2005)) . "\n";
?>
|
This will produce following result:
Dec 31 2005 20:00:00 Jan 01 2006 03:00:00 |
Copyright © tutorialspoint.com