Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Need to store a large number of hours and minutes (ie 36:30) best method?

I need to store in SQL Server 2005 an 'amount of time' for an application that records monthly overtime. E.g. someone could do 36 hours and 30 minutes overtime in one month. I need to store this and carry out calculations on it - what would be the best method.

Thanks

like image 817
SkipFeeney Avatar asked Oct 29 '25 16:10

SkipFeeney


1 Answers

Why not just store the number of minutes in a single integer column? That's the ideal representation for calculations (e.g. totals, ordering etc), and you can easily split it into hours and minutes when you need to format it.

like image 78
Jon Skeet Avatar answered Oct 31 '25 07:10

Jon Skeet



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!