Skip to main content

TIME

Returns a time string in the format HH:MM:SS.

See also:
[SELECT] [ Date Modifiers ]


Syntax

SELECT TIME(datetime_expression [, modifier, ...]) FROM <multipartIdentifier>;

Arguments

datetime_expression
The datetime value.

modifier
Zero or more modifiers to be applied to the datetime_expression. For more information about modifiers, see Date Modifiers

Return Value(s)

Returns a string representing the time component of the input datetime_expression with the modifier applied.


Examples

Return the time component of a datetime value

SELECT name, timeCreated,
time(timeCreated) as time_only
FROM google.storage.buckets WHERE project = 'stackql';

Return the local time component of a datetime value

SELECT name, timeCreated,
time(timeCreated, 'localtime') as local_time
FROM google.storage.buckets WHERE project = 'stackql';

For more information, see https://www.sqlite.org/lang_datefunc.html