Req #61987 [Opn->Wfx]: abbreviate "Y-m-d H:i:s" to Q
Edit report at https://bugs.php.net/bug.php?id=61987&edit=1
ID: 61987
Updated by: heiglandreas@php.net
Reported by: mark at skimbl dot com
Summary: abbreviate "Y-m-d H:i:s" to Q
-Status: Open
+Status: Wont fix
Type: Feature/Change Request
Package: Date/time related
Operating System: N/A
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2012-05-20 00:22:38] 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.
------------------------------------------------------------------------
[2012-05-19 16:50:36] 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-10 04:51:04] mark at skimbl dot com
Description:
------------
---
From manual page: http://www.php.net/function.date
---
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.
http://stackoverflow.com/search?q=Y-m-d+H%3Ai%3As
over 5.000 related issues
https://www.google.com/search?q=%22Y-m-d+H%3Ai%3As%22
over 1.7 million results
Easier and quicker to memorize.
Test script:
---------------
<?php
echo date('Q'); // Prints Q
Expected result:
----------------
2012-05-10 12:00:00
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=61987&edit=1
Thread (4 messages)