Home
SQL / MySQL
Aggregate Functions
Backup Load
Command MySQL
Cursor
Data Type
Database
Date Time
Engine
Event
Flow Control
FullText Search
Function
Geometric
I18N
Insert Delete Update
Join
Key
Math
Procedure Function
Regular Expression
Select Clause
String
Table Index
Transaction
Trigger
User Permission
View
Where Clause
XML
TIME_TO_SEC « Date Time « SQL / MySQL
SQL / MySQL
Date Time
TIME_TO_SEC
1.
Breaking Down Time Intervals into Components
2.
If you pass TIME_TO_SEC( ) a date-and-time value, it extracts the time part and discards the date.
3.
TIME_TO_SEC( ) converts a TIME value to the equivalent number of seconds
4.
TIME_TO_SEC(): strips off the date part and returns the time part as the corresponding number of seconds:
5.
To compute the total elapsed time, use TIME_TO_SEC( ) to convert the values to seconds before summing them.
6.
Using TIME_TO_SEC( ) to strip off the date part of the t_create values
7.
Transform the time differences into seconds using TIME_TO_SEC, add them, and then convert them back
8.
To express time values as minutes, hours, or days, perform the appropriate divisions:
9.
Forcing MySQL to Treat Strings as Temporal Values