Jump to content

[SOLVED] Formatting a MySQL DB Timestamp on Echo


OLG

Recommended Posts

Hey guys,

 

time for me to be the noob now (as if that ever changed :P)

 

How would i go about formatting a timestamp like this from my MYSQL DB: 20070720111445

 

Into something nice and coherent such as: 20th of July 2007 HH:MM

 

Thank you,

 

Adam

Link to comment
Share on other sites

Yes, i did know about the date format, but it keeps throwing out the wrong dates :P

 

I don't think its 2038 quite yet

 

What format is your timestamp in? Is it a unix timestamp?

 

If not look into www.php.net/strtotime

 

The issue lies within the timestamp, not the date function.

Link to comment
Share on other sites

I'm not actually sure, i've just changed over to a Plesk Server (8.1.1, using Virtuozzo, so i guess not) and am now having problems (its an older MYSQL Version)

 

its arranged YYYYMMDDHHMMSS (Year, Month, Day, Hour, Minute, Seconds)

 

strtotime returns -1, so i guess its telling me to go blow a fish right?

 

I might just do a regular expression match, use some backreferences and re-organise it and just leave it like that, can't be assed to screw around with a timestamp.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.