PHP strftime() 函數(shù)
定義和用法
strftime() 函數(shù)根據(jù)區(qū)域設(shè)置格式化本地時(shí)間/日期。
語法
strftime(format,timestamp)
參數(shù) | 描述 |
---|---|
format | 可選。規(guī)定如何返回結(jié)果。 |
timestamp | 可選。 |
提示和注釋
提示:與 gmstrftime() 的行為相同,不同的是返回時(shí)間是本地時(shí)間。
例子
輸出 strftime() 和 gmstrftime() 的結(jié)果:
<?php echo(strftime("%b %d %Y %X", mktime(20,0,0,12,31,98))); echo(gmstrftime("%b %d %Y %X", mktime(20,0,0,12,31,98))); //輸出當(dāng)前日期、時(shí)間和時(shí)區(qū) echo(gmstrftime("It is %a on %b %d, %Y, %X time zone: %Z",time())); ?>
輸出:
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