June 6, 2018 at 7:44 am
Good Experts,
Please help me to convert and find the difference in HH:MM:SS format between the two dates and time. Below are the columns
Step Start Time Step End Time
2018-04-01 23:55:00.8257333 2018-04-01 23:55:02.8569772
Thanks
June 6, 2018 at 8:06 am
tmmutsetse - Wednesday, June 6, 2018 7:44 AMGood Experts,
Please help me to convert and find the difference in HH:MM:SS format between the two dates and time. Below are the columns
Step Start Time Step End Time
2018-04-01 23:55:00.8257333 2018-04-01 23:55:02.8569772Thanks
Do you want to keep accuracy in your query? How much would you want? Will the difference be over 24 hours? over 31 days?
June 6, 2018 at 1:29 pm
Probably the best approach will be to find the difference in seconds, then convert that to the format you need. If you know the difference will ALWAYS be less than 24 hours, then maybe something like:CONVERT(VARCHAR(8), DATEADD(SECOND, DATEDIFF(SECOND, StepStartTime, StepEndTime), 0), 108)
otherwise you'll need to build the parts of time in the string, which could get messy.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply