为什么DateTime为时间戳添加T分隔符? [英] Why does DateTime add a T separator to the timestamp?

查看:199
本文介绍了为什么DateTime为时间戳添加T分隔符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码:

print DateTime->now;

回应:


2012-08-17T20:16:37

2012-08-17T20:16:37

为什么有T?有没有我忘记的选项?

Why is there a T? Is there an option I have forgotten?

推荐答案

T 只是一种标准(ISO 8601)方式来界定时间。要使用其他格式,请考虑使用 strftime format_cldr

The T is just a standard (ISO 8601) way to delimit the time. To use a different format, consider using strftime or format_cldr.

例如,要使用空格,请使用 DateTime-> now-> format_cldr( YYYY-MM-dd hh:mm:ss)

For example, to have a space instead, use DateTime->now->format_cldr("YYYY-MM-dd hh:mm:ss").

这篇关于为什么DateTime为时间戳添加T分隔符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆