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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: mail at scottbrinker dot com
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Tue May 06 12:01:29 2025 UTC