none
Adding minutes and seconds.

    Question

  • hi ,

    I need to add hours and minutes from the below 2 fields, any help is appreciated.

    label_yyyy_mm_dd_hh_mi        time_diff_in_mnts                 INeed
    2013-12-17 12:00                         8.67                            2013-12-17 12:08:7000
    2013-12-17 12:00                        10.23                           2013-12-17 12:10:23
    2013-12-17 12:15                          9.97
    2013-12-17 12:15                         11.15

    Thank you ,

    Vishal.

    Tuesday, January 21, 2014 7:20 PM

Answers

  • Your math in your question is not correct:

    select dateadd(second,   8.67*60 , '2013-12-17 12:00')

    • Marked as answer by vishal.... _ Tuesday, January 21, 2014 7:39 PM
    Tuesday, January 21, 2014 7:33 PM
    Moderator

All replies

  • DATEADD(Second, (@diff-FLOOR(@diff))*60,  DATEADD(MINUTE,FLOOR(@diff), @src))

    Tuesday, January 21, 2014 7:31 PM
    Moderator
  • Your math in your question is not correct:

    select dateadd(second,   8.67*60 , '2013-12-17 12:00')

    • Marked as answer by vishal.... _ Tuesday, January 21, 2014 7:39 PM
    Tuesday, January 21, 2014 7:33 PM
    Moderator
  • SELECT DATEADD(ss,FLOOR(time_diff_in_mnts)*60 + (time_diff_in_mnts-FLOOR(time_diff_in_mnts))*100,label_yyyy_mm_dd_hh_mi) FROM Table



    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs


    • Edited by Visakh16MVP Tuesday, January 21, 2014 7:39 PM
    Tuesday, January 21, 2014 7:37 PM
  • thanks tom that's what I need. yea true... I had an expression calculating in mins.. my bad thanks !
    Tuesday, January 21, 2014 7:40 PM