MariaDB: TIME Function
This MariaDB tutorial explains how to use the MariaDB TIME function with syntax and examples.
Description
The MariaDB TIME function extracts the time value from a time/datetime expression.
Syntax
The syntax for the TIME function in MariaDB is:
TIME( expression )
Parameters or Arguments
- expression
- The time or datetime value from which the time should be extracted.
Note
- If expression is not a time or a datetime value, the TIME function will return '00:00:00'.
- If expression is NULL, the TIME function will return NULL.
- See also the CAST function.
Applies To
The TIME function can be used in the following versions of MariaDB:
- MariaDB 10
Example
Let's look at some MariaDB TIME function examples and explore how to use the TIME function in MariaDB.
For example:
SELECT TIME('2014-11-16 06:18:01.000001'); Result: '06:18:01.000001' SELECT TIME('2014-11-16 18:20:19'); Result: '18:20:19' SELECT TIME('10:35:05'); Result: '10:35:05' SELECT TIME('The time is 10:35:05'); Result: '00:00:00' SELECT TIME(NULL); Result: NULL
Advertisements