SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Evangelist stonedeft's Avatar
    Join Date
    Aug 2009
    Posts
    586
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    get hour differnce from 2 columns question

    Hello Forums:
    I need to get the hour difference from two columns in this table and insert it in hours_today column:


    here's my query to get the difference in seconds

    $q = mysql_query("SELECT UNIX_TIMESTAMP(s_out) - UNIX_TIMESTAMP(s_in) AS dif FROM sd_record WHERE id = 1");

    Problem is how do I apply this arithmetic inside the query:

    floor(dif / (60 * 60)) -> to convert seconds to hours

    thnx
    Don't Panic

  2. #2
    SitePoint Evangelist stonedeft's Avatar
    Join Date
    Aug 2009
    Posts
    586
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nevermind head over to this thread :
    http://www.sitepoint.com/forums/show...=1#post4587935

    tnx to crmalibu
    Don't Panic


Tags for this Thread

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
  •