I'd like to store an amount of time for something in a mysql database,for the length of time something took, such as 2 hours, 5 minutes, 10 seconds. accuracy down to the second is preferred, but not required. What's the best way to go about doing this?
A MySQL TIME type can store time spans from '-838:59:59' to '838:59:59' - if that's within your required range, and it would be useful to have MySQL natively present these spans in HH:MM:SS form, then use that.
Otherwise, I'd just go with an integer type to represent the number of seconds.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With