UNIXEPOCH
The UNIXEPOCH() function returns the Unix epoch timestamp - the number of seconds since 1970-01-01 00:00:00 UTC.
This overload accepts a Unix epoch timestamp. While it seems redundant to convert a Unix epoch number to itself, this can be useful for standardizing a numeric value into the Unix epoch format or for applying modifiers.
Example
// SELECT UNIXEPOCH(1761301829, 'auto')
select(UNIXEPOCH(1761301829).unixepoch()).execute() // Result: 1761301829
// Applying a modifier
// SELECT UNIXEPOCH(1761301829, 'unixepoch', '+10 days')
select(UNIXEPOCH(1761301829).unixepoch().days(10)).execute() // Result: 1762165829Return
A KQLiteColumn of type KQLiteUnixEpoch representing the Unix epoch timestamp as a Long.
Author
MOHAMMAD AZIM ANSARI
Parameters
A Long representing the Unix epoch timestamp.
See also
The UNIXEPOCH() function returns the Unix epoch timestamp - the number of seconds since 1970-01-01 00:00:00 UTC.
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 converts this value into the corresponding Unix epoch timestamp.
Example
// SELECT UNIXEPOCH(2460972.93783565)
select(UNIXEPOCH(2460972.93783565)).execute() // Result: 1761301829Return
A KQLiteColumn of type KQLiteUnixEpoch representing the Unix epoch timestamp as a Long.
Author
MOHAMMAD AZIM ANSARI
Parameters
A Double representing the Julian day number.
See also
The UNIXEPOCH() function returns the Unix epoch timestamp - the number of seconds since 1970-01-01 00:00:00 UTC.
This overload accepts a date string. The date string can be in various formats recognized by SQLite, such as:
YYYY-MM-DDYYYY-MM-DD HH:MM:SS'now'and others.
The function converts the given string into its corresponding Unix epoch timestamp.
Example
// SELECT UNIXEPOCH('2025-10-24 10:30:29')
select(UNIXEPOCH("2025-10-24 10:30:29")).execute() // Result: 1761301829
// SELECT UNIXEPOCH('now')
select(UNIXEPOCH("now")).execute() // Result: current Unix timestamp
// Applying a modifier
// SELECT UNIXEPOCH('2025-10-24', '+5 hours')
select(UNIXEPOCH("2025-10-24").hours(5)).execute() // Result: 1761282000Return
A KQLiteColumn of type KQLiteUnixEpoch representing the Unix epoch timestamp as a Long. 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 UNIXEPOCH() function returns the Unix epoch timestamp - the number of seconds since 1970-01-01 00:00:00 UTC.
This overload accepts a KQLiteColumn that contains a time string, a numeric value (like a Julian day number or Unix epoch time), or the result of a date/time modification. This is particularly useful for applying the UNIXEPOCH() function to a table column or a chain of modifier functions.
Example
// Inside KQLiteTable
val eventTimestamp = dateTimeColumn("EventTimestamp") // Column stores "2025-10-24 10:30:29"
// SELECT UNIXEPOCH(EventTimestamp) FROM Events;
Events
.select(UNIXEPOCH(Events.eventTimestamp))
.execute() // Result: 1761301829Return
A KQLiteColumn of type KQLiteUnixEpoch representing the Unix epoch timestamp as a Long.
Author
MOHAMMAD AZIM ANSARI
Parameters
A KQLiteColumn containing a date/time value or the result of a date/time modification.