How do I convert a timespan, in seconds, to HH:MM:SS?
Often you want to compare two dates and/or times and express the difference in HH:MM:SS. Except there is no decent way to express the relationship this way; the built-in DATEDIFF function returns a single integer (seconds, minutes, hours, days, months, years, etc).
Here is a way in T-SQL to accomplish this:
Here it is in VBScript:
Related ArticlesCan I get millisecond accuracy in ASP?
Can I make VBScript format dates for me?
Could I get a little help with dates?
Given a date, how do I find the beginning and end of that week?
Given two dates, how do I determine an age?
How do I calculate dates, such as the first day of the month?
How do I convert a DATEDIFF to days, hours, and minutes?
How do I convert local time to UTC (GMT) time?
How do I count the number of business days between two dates?
How do I delimit/format dates for database entry?
How do I determine the number of seconds since 1/1/1970?
How do I display time in military format?
How do I implement a calendar / datepicker in ASP?
How do I select time only from a DATETIME column?
Why do I have problems inserting NOW() into a database?