SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: Time in secs

  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2001
    Location
    London, England
    Posts
    44
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Time in secs

    is there a more tidy way of getting the time of day in seconds than this?
    PHP Code:
    $time explode(":"gmdate("H:i:s"));
    $secs = ((($time[0] * 60) + $time[1]) * 60) + $time[2]; 
    Like is there a way to format the time in seconds without having to do this.

    Thanks

  2. #2
    epsilon transition cupid's Avatar
    Join Date
    Aug 2001
    Location
    Kent, Ohio
    Posts
    367
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Give this a try.. let me know if it still works past 1pm over there ;p


    $secs = (mktime() - mktime(0,0,0));

  3. #3
    SitePoint Enthusiast
    Join Date
    Aug 2001
    Location
    London, England
    Posts
    44
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks but nevermind, I was making a function to display the 'internet time' I had it working apart from when the time is more than 23:00:00 it started to go into the 1,000's

    But then I came across
    PHP Code:
    print date("B"); 
    Oh well

  4. #4
    epsilon transition cupid's Avatar
    Join Date
    Aug 2001
    Location
    Kent, Ohio
    Posts
    367
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    lol! Nice find!


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
  •