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?
Share
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.