常用php时间函数 date() mktime() strtotime()
string date ( string $format??? [, int $timestamp?? ] )
返回將整數 timestamp按照給定的格式字串而產生的字符串。如果沒有給出時間戳則使用本地當前時間。換句話說,timestamp是可選的,默認值為 time()。?
?
int strtotime??? ( string $time?? [, int $now? ] )
本函數預期接受一個包含美國英語日期格式的字符串并嘗試將其解析為?? Unix 時間戳(自 January 1 1970 00:00:00 GMT 起的秒數),其值相對于?? now 參數給出的時間,如果沒有提供此參數則用系統當前時間。
?
int mktime ([ int $hour?? [, int $minute?? [, int $second?? [, int $month?? [, int $day?? [, int $year?? [, int $is_dst? ]]]]]]] )
根據給出的參數返回 Unix 時間戳。時間戳是一個長整數,包含了從?? Unix 紀元(January 1 1970 00:00:00 GMT)到給定時間的秒數。?
?? 參數可以從右向左省略,任何省略的參數會被設置成本地日期和時間的當前值。?
?
轉載于:https://www.cnblogs.com/pvol/archive/2012/06/03/datetime_function.html
總結
以上是生活随笔為你收集整理的常用php时间函数 date() mktime() strtotime()的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: initialization of 'X
- 下一篇: jQuery和MooTools的真正区别