convert numeric string to date-time format

Discussion in 'PHP' started by cyn_di, Feb 16, 2009.

  1. #1
    how can i convert a numeric string [ex. 0903170700 -- (yymmddhhii) ] into a date-time group format so that i would be able to subtract 5 days from it?
     
    cyn_di, Feb 16, 2009 IP
  2. Altari

    Altari Peon

    Messages:
    188
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Where are you getting that string? Ideally, to do any kind of time manipulation, you should use UNIX time. Could you convert it to that?

    $time = time();
    $previousTime = strtotime("-5 days", $time); // UNIX time for 5 days ago
    echo(date("F d, Y", $previousTime); // show 5 days ago in Month day, Year format.
    PHP:
     
    Altari, Feb 16, 2009 IP