MySQL TIME_TO_SEC() Function
THE WORLD'S LARGEST WEB DEVELOPER SITE

MySQL TIME_TO_SEC() Function

❮ MySQL Functions

Example

Convert a time value into numeric seconds:

SELECT TIME_TO_SEC("19:30:10");
Try it Yourself »

Definition and Usage

The TIME_TO_SEC() function converts a time value into numeric seconds.

Syntax

TIME_TO_SEC(time)

Parameter Values

Parameter Description
time Required. The time value to convert

Technical Details

Works in: MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1, MySQL 4.0, MySQL 3.23

More Examples

Example

Convert a time value into numeric seconds:

SELECT TIME_TO_SEC("00:00:05");
Try it Yourself »

Example

Convert a time value into numeric seconds:

SELECT TIME_TO_SEC("03:30:00.999999");
Try it Yourself »

Example

Convert a time value into numeric seconds:

SELECT TIME_TO_SEC("-03:30:00");
Try it Yourself »

❮ MySQL Functions