JULIANDAY
The JULIANDAY() function returns the Julian day number - the number of days since noon in Greenwich on November 24, 4714BC.
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 converts this timestamp into the corresponding Julian day number.
Example
// SELECT JULIANDAY(1761301829, 'unixepoch')
select(JULIANDAY(1761301829).unixepoch()).execute() // Result: 2460972.93783565Return
A KQLiteColumn of type KQLiteJulianDay representing the Julian day number as a Double.
Author
MOHAMMAD AZIM ANSARI
Parameters
A Long representing the Unix epoch timestamp.
See also
The JULIANDAY() function returns the Julian day number - the number of days since noon in Greenwich on November 24, 4714BC.
This overload accepts a Julian day number. While it might seem redundant to convert a Julian day number to itself, this can be useful for standardizing a numeric value into the Julian day format expected by another date/time functions or for applying modifiers.
Example
// SELECT JULIANDAY(2460434.5)
select(JULIANDAY(2460434.5)).execute() // Result: 2460434.5
// Applying a modifier
// SELECT JULIANDAY(2460434.5, '+10 days')
select(JULIANDAY(2460434.5).days(10)).execute() // Result: 2460444.5Return
A KQLiteColumn of type KQLiteJulianDay representing the Julian day number as a Double.
Author
MOHAMMAD AZIM ANSARI
Parameters
A Double representing the Julian day number.
See also
The JULIANDAY() function returns the Julian day number - the number of days since noon in Greenwich on November 24, 4714BC.
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 Julian day number.
Example
// SELECT JULIANDAY('2024-05-04')
select(JULIANDAY("2024-05-04")).execute() // Result: 2460434.5
// SELECT JULIANDAY('now')
select(JULIANDAY("now")).execute() // Result: current Julian day
// Applying a modifier
// SELECT JULIANDAY('2024-05-04', '+1 month')
select(JULIANDAY("2024-05-04").months(1)).execute() // Result: 2460465.5Return
A KQLiteColumn of type KQLiteJulianDay representing the Julian day number as a Double. 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 JULIANDAY() function returns the Julian day number - the number of days since noon in Greenwich on November 24, 4714BC.
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 JULIANDAY() function to a table column or a chain of modifier functions.
Example
// Inside KQLiteTable
val eventTimestamp = dateTimeColumn("EventTimestamp") // Column stores "2024-05-04 12:00:00"
// SELECT JULIANDAY(EventTimestamp) FROM Events;
Events
.select(JULIANDAY(Events.eventTimestamp))
.execute() // Result: 2460435.0Return
A KQLiteColumn of type KQLiteJulianDay representing the Julian day number as a Double.
Author
MOHAMMAD AZIM ANSARI
Parameters
A KQLiteColumn containing a date/time value or the result of a date/time modification.