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

too long

I need to get the current GMT timestamp from PHP in the following format.

2012-03-05T16:53:13Z

Following is the method I used but it seems not accurate?

str_replace('+00:00', '.000Z', gmdate('c', strtotime("now")));

Date("c") is close to what you need but I'm not sure about your replacement.
As I see it you want the first 19 characters of date("c") and then a "Z".

date_default_timezone_set("UTC");
echo substr(date("c", time()), 0, 19). "Z";
//2018-12-13T05:45:45Z

https://3v4l.org/jM1o9

近期文章

  • 找到JSON无效字符
  • 使用以搜索表分隔的Ajax数据逗号构建SQL查询
  • 如何在PHP中通过cURL获取此节点ID?
  • php preg_replace,用span标记中的data属性替换所有span标记
  • CodeIgniter - 找不到类“CI_Loader”
  • too long
  • php从表中选择有限数量的数据,并按日期顺序进行延迟加载
  • 如何获取当前页面菜单项祖先名称wordpress
  • too long
  • too long
  • too long
  • Symfony 3.4 - 返回数组JsonResponse
  • 如何使用PHP对图像进行分页?
  • 如何在PHP中重定向502坏网关?
  • too long
  • 使用shell_exec写入Python中的文本文件
  • PHP / Laravel - Chartjs内爆不起作用
  • 路由web.php文件中的Laravel访问路由参数
  • 503后端提取失败 - Varnish Cache服务器Laravel
  • Laravel上的不稳定附加功能

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

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

友情链接:代码精华