DATE
The DATE() function returns the date as text in this format: YYYY-MM-DD.
This overload accepts a Unix epoch timestamp. The Unix epoch is the number of seconds since 1970-01-01 00:00:00 UTC.
Example
// SELECT DATE(1761301829, 'unixepoch')
select(DATE(1761301829).unixepoch()).execute()Return
A KQLiteColumn of type KQLiteDate representing the YYYY-MM-DD date.
Author
MOHAMMAD AZIM ANSARI
Parameters
A Long representing the Unix epoch timestamp.
See also
The DATE() function returns the date as text in this format: YYYY-MM-DD.
This overload accepts a Julian day number. A Julian day is the number of days since noon in Greenwich on November 24, 4714BC.
Example
// SELECT DATE(2460434.5)
select(DATE(2460434.5)).execute() // Result: "2024-05-04"Return
A KQLiteColumn of type KQLiteDate representing the YYYY-MM-DD date.
Author
MOHAMMAD AZIM ANSARI
Parameters
A Double representing the Julian day number.
See also
The DATE() function returns the date as text in this format: YYYY-MM-DD.
This overload accepts a timestring. The timestring can be in various formats recognized by SQLite, such as:
YYYY-MM-DDYYYY-MM-DD HH:MMYYYY-MM-DD HH:MM:SSYYYY-MM-DD HH:MM:SS.SSSYYYY-MM-DDTHH:MMand others, including
'now','start of month', etc.
Example
// SELECT DATE('2024-05-04 12:30:00')
select(DATE("2024-05-04 12:30:00")).execute() // Result: "2024-05-04"
// SELECT DATE('now')
select(DATE("now")).execute() // Result: current date
// Applying a modifier
// SELECT DATE('now', 'start of month', '+10 days')
select(DATE("now").startOfMonth().days(10)).execute()Return
A KQLiteColumn of type KQLiteDate representing the YYYY-MM-DD date. 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 DATE() function returns the date as text in this format: YYYY-MM-DD.
This overload constructs a date string from individual integer components for YEAR, MONTH, and DAY. It internally formats these components into a YYYY-MM-DD string that SQLite can parse.
Example
// SELECT DATE('2024-05-04')
select(DATE(2024, 5, 4)).execute()Return
A KQLiteColumn of type KQLiteDate representing the YYYY-MM-DD date.
Author
MOHAMMAD AZIM ANSARI
Parameters
The year (e.g., 2024).
The month of the year (1-12).
The day of the month (1-31).
See also
The DATE() function returns the date as text in this format: YYYY-MM-DD.
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 DATE() function to a table column. It also supports applying modifiers to the date/time value before extracting the date part.
Example
// Inside KQLiteTable
val loginTime = timeColumn("Login") // Column stores "2024-05-04 15:30:00"
// SELECT DATE(loginTime) FROM Employees;
Employees
.select(Employees.loginTime)
.execute() // Result: "2024-05-04"Return
A KQLiteColumn of type KQLiteDate representing the YYYY-MM-DD date.
Author
MOHAMMAD AZIM ANSARI
Parameters
A KQLiteColumn containing a date/time value or the result of a date/time modification.