Curriculum
Course: SQL
Login

Curriculum

SQL

SQL References

0/80

MySQL Functions

0/139

SQL Server Functions

0/84

SQL Quick Ref

0/1
Text lesson

TIME_TO_SEC

Example

Convert a time value to its equivalent in seconds.

SELECT TIME_TO_SEC(“19:30:10”);

Definition and Usage

The TIME_TO_SEC() function converts a given time value into its equivalent in seconds.

Syntax

TIME_TO_SEC(time)

Parameter Values

Parameter

Description

time

Required: The time value to convert

Technical Details

Works in:

 From MySQL version 4.0

More Examples

Example

SELECT TIME_TO_SEC(“00:00:05”);

Example

Convert a given time value into seconds.

SELECT TIME_TO_SEC(“03:30:00.999999”);

Example

Convert a specified time value into its equivalent in seconds.

SELECT TIME_TO_SEC(“-03:30:00”);