Translating MySQL timestamp to datetime
From: Joshua Beall (jbeall_at_donotspam.remove.me.heraldic.us)
Date: 04/22/04
- Next message: Geoff Berrow: "Re: Translating MySQL timestamp to datetime"
- Previous message: Joshua Beall: "Re: Polymorphism in PHP"
- Next in thread: Geoff Berrow: "Re: Translating MySQL timestamp to datetime"
- Reply: Geoff Berrow: "Re: Translating MySQL timestamp to datetime"
- Reply: Jon Kraft: "Re: Translating MySQL timestamp to datetime"
- Reply: Paul Delannoy: "Re: Translating MySQL timestamp to datetime"
- Reply: Markus Ernst: "Re: Translating MySQL timestamp to datetime"
- Reply: Marian Heddesheimer: "Re: Translating MySQL timestamp to datetime"
- Reply: Andrew _at_ Rockface: "Re: Translating MySQL timestamp to datetime"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 22 Apr 2004 13:13:16 GMT
Hi All,
Any thoughts on the easiest way to translate a MySQL timestamp (which looks
like 20040422090941) to the datetime format (which looks like 2004-04-22
09:09:41). This is just to make it easier for a human to read it.
I have thought about splitting it into chunks using something like
str_split, then piecing it back together, but it seems like there should be
an easier way. And also, I am not running PHP5.
I already tried date("Y-m-d H:i:s",strtotime("20040422090941")), and had no
luck. strtotime cannot handle that format.
This seems like the sort of thing you should be able to do in 1 line of
code. Any pointers?
-Josh
- Next message: Geoff Berrow: "Re: Translating MySQL timestamp to datetime"
- Previous message: Joshua Beall: "Re: Polymorphism in PHP"
- Next in thread: Geoff Berrow: "Re: Translating MySQL timestamp to datetime"
- Reply: Geoff Berrow: "Re: Translating MySQL timestamp to datetime"
- Reply: Jon Kraft: "Re: Translating MySQL timestamp to datetime"
- Reply: Paul Delannoy: "Re: Translating MySQL timestamp to datetime"
- Reply: Markus Ernst: "Re: Translating MySQL timestamp to datetime"
- Reply: Marian Heddesheimer: "Re: Translating MySQL timestamp to datetime"
- Reply: Andrew _at_ Rockface: "Re: Translating MySQL timestamp to datetime"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|