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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

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-2022 The PHP Group
All rights reserved.
Last updated: Fri Jan 28 05:03:34 2022 UTC