PHP使用gmdate實現將一個UNIX 時間格式化成GMT文本的方法
來源:易賢網 閱讀:925 次 日期:2015-03-23 14:37:49
溫馨提示:易賢網小編為您整理了“PHP使用gmdate實現將一個UNIX 時間格式化成GMT文本的方法”,方便廣大網友查閱!

這篇文章主要介紹了PHP使用gmdate實現將一個UNIX 時間格式化成GMT文本的方法,實例分析了php中gmdate函數的功能及使用技巧,具有一定參考借鑒價值,需要的朋友可以參考下

本文實例講述了PHP使用gmdate實現將一個UNIX 時間格式化成GMT文本的方法。分享給大家供大家參考。具體分析如下:

語法如下:

string gmdate (string $Format)

string gmdate (string $Format, int $Time)

演示代碼

<?php

echo "When this page was loaded,\n";

echo 'It was then ', gmdate ('r'), "\n";

echo 'The currend gmdate was ', gmdate ('F j, Y'), "\n";

echo 'The currend gmdate was ', gmdate ('M j, Y'), "\n";

echo 'The currend gmdate was ', gmdate ('m/d/y'), "\n";

echo 'The currend gmdate was the ', gmdate ('jS \o\f M, Y'), "\n";

echo 'The currend time was ', gmdate ('g:i:s A T'), "\n";

echo 'The currend time was ', gmdate ('H:i:s O'), "\n";

echo gmdate ('Y');

gmdate ('L')?(print ' is'):(print ' is not');

echo " a leap year\n";

echo time ('U'), " seconds had elapsed since January 1, 1970.\n";

?>

輸出結果如下:

When this page was loaded,

It was then Sun, 27 Dec 2009 13:08:53 +0000

The currend gmdate was December 27, 2009

The currend gmdate was Dec 27, 2009

The currend gmdate was 12/27/09

The currend gmdate was the 27th of Dec, 2009

The currend time was 1:08:53 PM GMT

The currend time was 13:08:53 +0000

2009 is not a leap year

1261919333 seconds had elapsed since January 1, 1970.

希望本文所述對大家的php程序設計有所幫助。

更多信息請查看IT技術專欄

更多信息請查看網絡編程

2026上岸·考公考編培訓報班

  • 報班類型
  • 姓名
  • 手機號
  • 驗證碼
關于我們 | 聯系我們 | 人才招聘 | 網站聲明 | 網站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 新媒體/短視頻平臺 | 手機站點 | 投訴建議
工業(yè)和信息化部備案號:滇ICP備2023014141號-1 云南省教育廳備案號:云教ICP備0901021 滇公網安備53010202001879號 人力資源服務許可證:(云)人服證字(2023)第0102001523號
聯系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關注公眾號:hfpxwx
咨詢QQ:1093837350(9:00—18:00)版權所有:易賢網