JULIANTIMESTAMP Function
The JULIANTIMESTAMP function converts a datetime value into a 64-bit Julian timestamp value
that represents the number of microseconds that have elapsed between 4713 B.C., January 1,
00:00, and the specified datetime value. JULIANTIMESTAMP returns a value of data type
LARGEINT.
The function is evaluated once when the query starts execution and is not reevaluated (even if
it is a long running query).
JULIANTIMESTAMP is a Neoview SQL extension.
JULIANTIMESTAMP (datetime-expression)
datetime-expression
is an expression that evaluates to a value of type DATE, TIME, or TIMESTAMP. If
datetime-expression does not contain all the fields from YEAR through SECOND,
Neoview SQL extends the value before converting it to a Julian timestamp. Datetime fields
to the left of the specified datetime value are set to current date fields. Datetime fields to the
right of the specified datetime value are set to zero. See
(page
257).
Considerations for JULIANTIMESTAMP
The datetime-expression value must be a date or timestamp value from the beginning of
year 0001 to the end of year 9999.
Examples of JULIANTIMESTAMP
The PROJECT table consists of five columns using the data types NUMERIC, VARCHAR, DATE,
TIMESTAMP, and INTERVAL.
•
Convert the TIMESTAMP value into a Julian timestamp representation:
SELECT ship_timestamp, JULIANTIMESTAMP (ship_timestamp)
FROM persnl.project
WHERE projcode = 1000;
SHIP_TIMESTAMP
--------------------------
2008-04-21 08:15:00.000000
--- 1 row(s) selected.
•
Convert the DATE value into a Julian timestamp representation:
SELECT start_date, JULIANTIMESTAMP (start_date)
FROM persnl.project
WHERE projcode = 1000;
START_DATE
----------
2008-04-10
--- 1 row(s) selected.
(EXPR)
--------------------
(EXPR)
--------------------
212074545600000000
"Datetime Value Expressions"
212075525700000000
JULIANTIMESTAMP Function
409