TIME
The TIME() function returns the time as text in this format: HH:MM:SS.
This overload accepts a Unix epoch timestamp. The Unix epoch is the number of seconds since 1970-01-01 00:00:00 UTC. The function extracts the time part from this timestamp.
Example
// SELECT TIME(1761301829, 'unixepoch')
select(TIME(1761301829).unixepoch()).execute() // Result: "10:30:29"Return
A KQLiteColumn of type KQLiteTime representing the HH:MM:SS time.
Author
MOHAMMAD AZIM ANSARI
Parameters
A Long representing the Unix epoch timestamp.
See also
The TIME() function returns the time as text in this format: HH:MM:SS.
This overload accepts a Julian day number. A Julian day is the number of days since noon in Greenwich on November 24, 4714BC. The function extracts the time part from the fractional component of the Julian day.
Example
// SELECT TIME(2460434.771180555)
select(TIME(2460434.771180555)).execute() // Result: "06:30:30"Return
A KQLiteColumn of type KQLiteTime representing the HH:MM:SS time.
Author
MOHAMMAD AZIM ANSARI
Parameters
A Double representing the Julian day number.
See also
The TIME() function returns the time as text in this format: HH:MM:SS.
This overload accepts a time string. The time string can be in various formats recognized by SQLite, such as:
YYYY-MM-DD HH:MMYYYY-MM-DD HH:MM:SSYYYY-MM-DD HH:MM:SS.SSSHH:MMHH:MM:SSHH:MM:SS.SSS'now'
Example
// SELECT TIME('2024-05-04 15:30:45')
select(TIME("2024-05-04 15:30:45")).execute() // Result: "15:30:45"
// SELECT TIME('now')
select(TIME("now")).execute() // Result: current time
// Applying a modifier
// SELECT TIME('now', 'localtime', '+2 hours')
select(TIME("now").localtime().hours(2)).execute()Return
A KQLiteColumn of type KQLiteTime representing the HH:MM:SS time. The result can be null if the input string is not a recognized time string.
Author
MOHAMMAD AZIM ANSARI
Parameters
A String representing the date/time.
See also
The TIME() function returns the time as text in this format: HH:MM:SS.
This overload constructs a time string from individual integer components for hour, minute, second, and subsecond. It internally formats these components into a HH:MM:SS.SSS string that SQLite can parse.
Example
// SELECT TIME('15:30:45')
select(TIME(15, 30, 45)).execute() // Result: "15:30:45"
// SELECT TIME('09:05:00')
select(TIME(9, 5)).execute() // Result: "09:05:00"
// SELECT TIME('09:05:01.123')
select(TIME(9, 5, 1, 123)).execute() // Result: "09:05:01" (Note: SQLite's TIME() function truncates subseconds)Return
A KQLiteColumn of type KQLiteTime representing the HH:MM:SS time.
Author
MOHAMMAD AZIM ANSARI
Parameters
The hour of the day (0-23).
The minute of the hour (0-59).
The second of the minute (0-59), optional.
The sub-second (e.g., milliseconds), optional. Note that the standard TIME() function in SQLite will not include subsecond in its output.
See also
The TIME() function returns the time as text in this format: HH:MM:SS.
This overload accepts a KQLiteColumn that contains a time string or a numeric value (like a Julian day number or Unix epoch time). This is useful for applying the TIME() function to a table column. It also supports applying modifiers to the date/time value before extracting the time part.
Example
// Inside KQLiteTable
val loginTime = dateTimeColumn("LoginTime") // Column stores "2024-05-04 15:30:45"
// SELECT TIME(LoginTime) FROM Users;
Users
.select(TIME(Users.loginTime))
.execute() // Result: "15:30:45"Return
A KQLiteColumn of type KQLiteTime representing the HH:MM:SS time.
Author
MOHAMMAD AZIM ANSARI
Parameters
A KQLiteColumn containing a date/time value or the result of a date/time modification.