Web Analytics Made Easy -
StatCounter Time difference between TIMESTAMP fields - CodingForum

Announcement

Collapse
No announcement yet.

Time difference between TIMESTAMP fields

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Time difference between TIMESTAMP fields

    Anyone know how to return the difference in time (in seconds) between two TIMESTAMP fields?

    I am using MySQL ver 4.0.12 thus TIMEDIFF and all those other fancy functions dont work!

  • #2
    SELECT SECOND(TIMEDIFF(expr,expr2));

    or

    SELECT MICROSECOND(TIMEDIFF(expr,expr2));

    I never try it out, but let me know if it works or not.

    Comment


    • #3
      Read above!!!

      I am using MySQL ver 4.0.12 thus TIMEDIFF and all those other fancy functions dont work!

      Comment


      • #4
        I am so sorry Mark, I didn't read carefully.

        how about this?

        select second(date_time) - second(date_time_2) as different_time;

        Comment


        • #5
          That might work! I'll give it a shot. Thanks.

          Comment

          Working...
          X