SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist silversurfer5150's Avatar
    Join Date
    Aug 2010
    Posts
    534
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question UNIX time to string

    HI guys,

    I have a unix timestamp: 7138 - the result of subtracting two timestamps and now I need to put it back to a string and pad it out with zeros so that I get: hh/mm/ss

    if $resut is my timestamp (7138)

    why can't I do:

    $readable = date('H:i:s', $result);

    when I echo this it comes out as:

    20:58:58 but I know from using an online UNIX calculator that this should be:

    01:58:58 What am I doing wrong???
    "Persistence is the path to perfection"

  2. #2
    @php.net Salathe's Avatar
    Join Date
    Dec 2004
    Location
    Edinburgh
    Posts
    1,397
    Mentioned
    63 Post(s)
    Tagged
    0 Thread(s)
    See this recent thread which had a very, very similar issue: http://www.sitepoint.com/forums/php-...re-768289.html
    Salathe
    Software Developer and PHP Manual Author.

  3. #3
    SitePoint Evangelist silversurfer5150's Avatar
    Join Date
    Aug 2010
    Posts
    534
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thankyou so much for your help. has been such a pain to sort this
    "Persistence is the path to perfection"


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •