|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #9902 Converting to/from mysql timestamp
Submitted: 2001-03-21 11:56 UTC Modified: 2002-07-16 01:44 UTC
From: mail at scottbrinker dot com Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 4.0.4pl1 OS: Red Hat Linux 7.x
Private report: No CVE-ID: None
 [2001-03-21 11:56 UTC] mail at scottbrinker dot com
I propose some new functions for those of us that use PHP and mySQL together on a daily basis...

I would suggest a function that acts like getdate() which produces an array of time and date data from a mySQL timestamp (YYYYMMDDHHMMSS).

Along these lines, functions which convert between a unix timestamp and a mySQL timestamp would be useful.

Surely I'm not the only one that has to include my own custom functions to produce these results.

Having standard distribution-based versions of these functions would make my and others work a lot easier.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-16 01:44 UTC]
It's make no sense to have this functionality on the 
client side, if the server side supports it already.
Use the MySQL Functions DATE_FORMAT, TIME_FORMAT and 
UNIX_TIMESTAMP for converting timestamp fields.

If you need some more special functions, you can also 
extend MySQL with an additionally UDF.

 [2004-05-10 23:33 UTC] phpbug at intobikes dot co dot uk
Scott.. I totally agree.  When doing a SELECT * FROM...... query you aren't specifying the fields, so cannot convert the timestamp field as suggested.  It is a glaring omission from PHP that really should be fixed.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Jul 24 15:01:29 2024 UTC