|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #61987 abbreviate "Y-m-d H:i:s" to Q
Submitted: 2012-05-10 04:51 UTC Modified: 2017-01-13 07:02 UTC
Avg. Score:3.6 ± 1.7
Reproduced:5 of 7 (71.4%)
Same Version:3 (60.0%)
Same OS:3 (60.0%)
From: mark at skimbl dot com Assigned:
Status: Wont fix Package: Date/time related
PHP Version: Irrelevant OS: N/A
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: mark at skimbl dot com
New email:
PHP Version: OS:


 [2012-05-10 04:51 UTC] mark at skimbl dot com
From manual page:
Is there any chance the common Y-m-d H:i:s can be summarized as "Q" for the common MySQL datetime format. I have written this sequence hundreds of times (You're the man now dog, Hamlet in space?)
Seeing as MySQL and PHP are so commonly tied together I think this could be a very useful shortcut to add. over 5.000 related issues over 1.7 million results
Easier and quicker to memorize.

Test script:
echo date('Q'); // Prints Q

Expected result:
2012-05-10 12:00:00


php_data.patch (last revision 2012-05-14 14:51 UTC by zhanglijiu at gmail dot com)

Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-05-19 16:50 UTC] joergybehrens at gmail dot com
Hi mark: You could add the function by yourself. Boz the new feature could affect 
other parameter of Data() function. And the patch you could try for your own 
version PHP.
 [2012-05-20 00:22 UTC] zhanglijiu at gmail dot com
@joergybehrens I checked the parameter Q, which is not the key word of parameter. 
It can be used for the function. But the problem is personal problem, which is 
difficult to be pulled in git.
 [2017-01-13 07:02 UTC]
-Status: Open +Status: Wont fix
 [2017-01-13 07:02 UTC]
This is already existent. You can format a date using 'c' and insert that into a DATETIME-field in MySQL. The Offset is ignored. 

If you insert "2004-02-12T15:19:21+04:00" it will show up on the database as "2004-02-12 15:19:21". So make sure the datetimes you are inserting all have the same offset.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Fri Feb 03 01:03:42 2023 UTC