Simple php data question

Discussion in 'PHP' started by phpmymovie, Feb 4, 2010.

  1. #1
    Hi,

    Do any one know how to achieve this

    if i deduct a current timestamp to a past timestamp like:

    $elapse=time()-<any past time lets say time()-86400>

    so $elapse will be equal to 86400

    so if i want to convert the $elapse to how many hrs minute second month years like for 86400 it will be 1 day 86402 =1 day and 2 secs


    so i need a function where i just pass a timestamp and it will convert it to hrs minutes days and month
     
    Last edited: Feb 4, 2010
    phpmymovie, Feb 4, 2010 IP
  2. hireme

    hireme Member

    Messages:
    58
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    45
    #2
    mmmm so what was the question again?
     
    hireme, Feb 4, 2010 IP
  3. clinton

    clinton Well-Known Member

    Messages:
    2,166
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    110
    #3
    try strtotime with a date function...

    e.g.

    date("j, n, Y", time() - 86400);

    the php date function allows you to display the time in unlimited ways. Take a look at http://ca2.php.net/manual/en/function.date.php

    Hope this helps
     
    clinton, Feb 4, 2010 IP