Hey guys,

i've got a problem with a little php project i set myself. I save a value as a type: "timestamp" with a default value of "current_timestamp" into a database. A typical value looks like:

2007-04-03 23:26:05

I was trying to figure out how i can manipulate this value to try and format it into a more friendly string, something like "3rd April 2007 11:26pm". I've looked at all the date and time functions but i cant figure out how to manipulate the initial value.

Thanks for anyones help in advance,

Aj

    $timestamp = "2007-04-03 23:26:05";
    $friendly = date('jS F Y h:ia', strtotime($timestamp));
    echo $friendly;
    

      Thanks a lot NogDog, that did the trick!

        [man]strtotime/man can be very versatile in reading in dates of all shapes and sizes.

        BUT then again... why even let PHP retrieve the wrong date from the DB in the first place? You could instead modify your query to something like this:

        SELECT DATE_FORMAT(`date_field`, '%D %M %Y %h:%i%p') AS `date_field` ...
          Write a Reply...