php 把秒数转换成时分秒格式输出...
时间:2010-08-12 来源:radkitty
gmstrftime('%H:%M:%S',800);
显示格式如下:
00:03:27
Definition and Usage
The gmstrftime() function formats a GMT/UTC time or date according to locale settings.
Syntax
gmstrftime(format,timestamp) |
Parameter | Description |
---|---|
format |
Required. Specifies how to return the result:
|
timestamp | Optional. Specifies the date or time to be formatted. If no timestamp is specified, it uses the current GMT time. |
Tips and Notes
Tip: This function is identical to strftime() except that the time returned is Greenwich Mean Time (GMT).
Example
Example of both strftime() and gmstrftime():
<?php echo(strftime("%b %d %Y %X", mktime(20,0,0,12,31,98))."<br />"); echo(gmstrftime("%b %d %Y %X", mktime(20,0,0,12,31,98))."<br />"); //Print the current date, time, and time zone. echo(gmstrftime("It is %a on %b %d, %Y, %X time zone: %Z",time())); ?> |
The output of the code above could be:
Dec 31 1998 20:00:00 Dec 31 1998 19:00:00 It is Wed on Jan 25, 2006, 11:32:10 time zone: W. Europe Standard Time |
相关阅读 更多 +