php.net |  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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
30 - 25 = ?
Subscribe to this entry?

 
 [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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-16 01:44 UTC] georg@php.net
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.

John
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 22:01:28 2024 UTC