Timestamp Conversion
Moderator: General Moderators
Timestamp Conversion
I have always had problems with converting timestamp and datetime. I echo (from a MySQL database) the timestamp field and it give me this: 1143930624. How do I know whether this is a UNIX TIMESTAMP or not? And then how do I convert it? 
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
is a unix timestamp. Why? it's too large for a "standard" textual one (often in the format YYYYMMDD or YYYY-MM-DD)AliasBDI wrote:1143930624
Now, how does one convert it? Convert it to what? To MySQL standard notation for a DATE field, date('Y-m-d', 1143930624); for a DATETIME field date('Y-m-d H:i:s', 1143930624); for a TIMESTAMP date('YmdHis', 1143930624); for a TIME field date('H:i:s', 1143930624), etc etc.
I'm wanting to echo it out to 'MM-DD-YYYY'. I tried this date('m-d-Y', $row_conDETAILS['createDATE']); but it does not work. It gives me '01-18-2038'. It should give '04-01-2006'.
*It looks like when I originally posted my full echo of the timestamp did not post. Nevertheless, according to your standards, it is still a timestamp. This is what it echos with no MySQL query conversion: '20060401163024'. Does it matter that this is a Windows Server?
*It looks like when I originally posted my full echo of the timestamp did not post. Nevertheless, according to your standards, it is still a timestamp. This is what it echos with no MySQL query conversion: '20060401163024'. Does it matter that this is a Windows Server?