php 获取TZ时间格式
php将时间格式化成T Z的方法
gmdate("c") 这个函数的用法,学会了吧!!!
<?php var_dump(gmdate("c")); ini_set("date.timezone", "Etc/GMT"); $date = gmdate('c'); var_dump($date); $date2 = str_replace('+00:00', 'Z', gmdate('c')) ; var_dump($date2); $now = date("Y-m-d H:i:s"); var_dump($now);
--------------------------------------------------------------------------------------------
![Created](http://static.kuitao8.com/images/history.png)
![Views Views](http://static.kuitao8.com/images/view.gif)
![Author Author](http://static.kuitao8.com/images/author.png)
这应该给适当的ISO8601 Z(ulu)时区的日期/时间:
- str_replace('+00:00', 'Z', gmdate('c'))
或者:
- str_replace('+00:00', 'Z', gmdate('c', strtotime('2013-05-07 18:56:57')))
也可以:
- str_replace('+00:00', '.000Z', gmdate('c', strtotime('2013-05-07 18:56:57')))