convert unix to day and hour

Discussion in 'PHP' started by srdva59, Jul 3, 2010.

  1. #1
    hi,

    i want convert the time stamp unix format to hours and days

    i have this:

    $date = trim(date('H:i:s', $ofwhat));

    $ida = trim(date('d', $ofwhat)) -1;

    if ($ida >0) {if ($ida==1) { $dia= $ida. " day, "; } }

    if ($ida >0) { if ($ida>1) { $dia= $ida. " days, "; } }


    this work fine in my local pc that have php 4
    if i put this: echo unix2data(3600,4); they return 1 hour that is correct

    but when i put in the server running php 5
    the echo unix2data(3600,4); return 19 hours!
    what i doing wrong?
    thanks a lot for your help
     
    srdva59, Jul 3, 2010 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,790
    Likes Received:
    4,529
    Best Answers:
    123
    Trophy Points:
    665
    #2
    sarahk, Jul 3, 2010 IP
  3. intivev

    intivev Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    @ srdva59
    Its the matter that ur local server and online one are both inn two different time zones.... if u cab elaborate....it more or say what ur requirement is we can discuss it......
     
    intivev, Jul 3, 2010 IP