TIME_TO_SEC

TIME_TO_SEC is an SQL function used to convert a time value into seconds. This function returns the number of seconds passed since midnight as an integer. The returned value ranges from -838:59:59 to 838:59:59.

TIME_TO_SEC(time)

  • time: This represents the time value that would be converted into seconds. The time value must be in the format ‘HH

Example

SELECT TIME_TO_SEC('22:23:00');

Output

80280

Explanation

This SQL function converts a time value in the format of ‘HH:MM:SS’ into seconds. In this example, it converts ‘22:23:00’ into 80280 seconds.

For in-depth explanations and examples SQL keywords where you write your SQL, install our extension.