Reputation: 229
I need to convert milliseconds,seconds,minutes,hours into days in sql server 2005. Can anybody help me?
Upvotes: 0
Views: 13911
Reputation: 8704
In integer arithmetic, using the values:
1 second == 1,000 milliseconds;
1 minute == 60,000 milliseconds;
1 hour == 3,600,000 milliseconds;
1 day == 86,400,000 milliseconds;
Convert seconds, minutes, and hours to milliseconds.
Then find integer and fractional days:
integral days (in units) = total_milliseconds / 86,400,000
fractional days (in milliseconds = total_milliseconds % 86,400,000
And there you have it.
Upvotes: 4