简体   繁体   English

仅将PHP Mysql日期格式输出为ISO 8601,并带有“ T”符号

[英]Output PHP Mysql Date format to ISO 8601 with “T” sign only

I would like to get a datetime formatted a specific way. 我想获取格式化为特定方式的日期时间。 Can I do this in MySQL or do I need to do it in PHP? 我可以在MySQL中执行此操作还是需要在PHP中执行此操作?

This is the output from MYSQL : 这是MYSQL的输出:

2016-01-30 23:21:46

I need it formatted in this (similar but not exactly the same) fashion: 我需要以这种(相似但不完全相同)的方式格式化它:

2016-01-30T23:21:46

Is there a PHP function to handle this correctly or is it possible to change it from MYSQL? 是否有PHP函数可以正确处理此问题,或者可以从MYSQL进行更改?

您可以使用insert()

select insert(<whatever>, 11, 1, 'T')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM