I'm having a data column named test_duration bigint(12). I'm storing time in seconds into the database. Now when I fetch record from the table I want the time converted into HH:MM:SS format. How should I achieve this? Thanks in advance.
You can use MySQL function SEC_TO_TIME().
Example:
SELECT SEC_TO_TIME(2378);
Output is:
00:39:38
So in your case:
SELECT SEC_TO_TIME(test_duration) as `Time` FORM YOUR_TABLE;
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