我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

如何获得这个日期/时间格式?

I saw a date/time format in a PHP code that has something like this:

2015-06-19T00:38:04Z

How can I generate a datetime having that kind of format?

I know this kind of format date("Y-m-d H:i:s"); outputs different 2015-06-19T00:38:04Z because it has a T and a Z.

So it's like I want to get the current date/time having a T and a Z

Escape T and Z in format

echo date("Y-m-d\TH:i:s\Z"); // 2015-06-17T16:50:50Z

UPDATE Thanks to Lithis. To take a GMT/UTC time

echo gmdate("Y-m-d\TH:i:s\Z");  // 2015-06-17T17:06:06Z

近期文章

  • 使用.htaccess删除页面扩展错误Facebook Open Graph
  • gmail SMTP服务器设置
  • 为XAMPP设置环境变量
  • 带有共享wp内容的IIS上的Wordpress
  • 使用PHP解码多个JSON URL
  • 使用echo&exit结束php中的一个函数
  • PHP页面是空白的,源代码是空的
  • Laravel总是重定向某些路线
  • PHP - Steam API Web Connect OpenID - >无重定向
  • 如何在两个Android应用程序之间共享PHP会话?
  • Magento Shipping Method Rate返回NULL
  • 彩色框弹出窗体中的表单不会提交
  • 无法编辑Contao模块内项目中的所有字段
  • 具体5电子邮件发送问题到谷歌应用程序
  • 使用Zend的GData库获取Google Drive的文件夹名称/访问权限
  • 由于gem_original_require错误,无法从php运行ruby脚本
  • 在修复html表上显示php数组而不影响行数
  • 尝试开始使用在CronJob中运行的PHP或Shell中的脚本
  • 在PHP5.5中找不到SQLite3
  • PHP联接 - 提交表单时

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华