Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
This page describes how to use date and time functions in Lenses SQL Processors.
Every Date Math expression starts with a base date or time followed by the addition or subtraction of one or more durations.
The base date or time (from here onward) is derived from a field in a table or a function such as now()
or yesterday()
that generates datetime values.
The shorthand syntax is a unit value followed by a unit symbol. The symbols are:
y (year)
M (month)
w (week)
d (day)
h (hour)
m (minute)
s (second)
This page describes the DATE function in Lenses SQL.
Builds a local date value from a long or int value. This function can also be used with no parameters to return the current ISO date.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the CONVERT_DATETIME function in Lenses SQL.
Converts the string format of a date [and time] to another using the pattern provided.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the EXTRACT_TIME function in Lenses SQL.
Extracts the time portion of a timestamp-micros or timestamp-millis returning a time-millis or time-micros value depending on the timestamp precision.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the EXTRACT_DATE function in Lenses SQL.
Extracts the date portion of a timestamp-micros or timestamp-millis returning a date value.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the FORMAT_DATE function in Lenses SQL.
Returns a string representation of a date value according to a given pattern.
Available in:
Processors | SQL Studio |
---|
Sample code:
Output:
This page describes the FORMAT_TIME function in Lenses SQL.
Returns a string representation of a time value according to a given pattern.
Available in:
Processors | SQL Studio |
---|
Sample code:
Output:
This page describes the DATETIME function in Lenses SQL.
Provides the current ISO date and time.
Available in:
Processors | SQL Studio |
---|
Sample code:
Output:
✓
✓
✓
✓
✓
✓
✓
✓
✓ | ✓ |
✓ | ✓ |
✓ | ✓ |
This page describes the MONTH function in Lenses SQL.
Builds a timestamp-millis value from a long or int value.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the MONTH_TEXT function in Lenses SQL.
Returns the month name.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the MINUTE function in Lenses SQL.
Extracts the minute component of an expression that is of type timestamp.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the HOUR function in Lenses SQL.
Extracts the hour component of an expression that is of type timestamp.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the FORMAT_TIMESTAMP function in Lenses SQL.
Returns a string representation of a timestamp value according to a given pattern.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the PARSE_TIMESTAMP_MILLIS function in Lenses SQL.
Builds a timestamp-millis value given a datetime string representation and a date time pattern.
Available in:
Processors | SQL Studio |
---|
Sample code:
Output:
This page describes the PARSE_DATE function in Lenses SQL.
Builds a date value given a date string representation and a date pattern.
Available in:
Processors | SQL Studio |
---|
Sample code:
Output:
This page describes the PARSE_TIME_MICROS function in Lenses SQL.
Builds a time-micros value given a time string representation and a time pattern.
Available in:
Processors | SQL Studio |
---|
Sample code:
Output:
This page describes the TIME_MICROS function in Lenses SQL.
Builds a time-micros value from a long or int value.
Available in:
Processors | SQL Studio |
---|
Sample code:
Output:
This page describes the TIMESTAMP function in Lenses SQL.
Returns a timestamp for a given date and time at a specific zone id.
Available in:
Processors | SQL Studio |
---|
Sample code:
Output:
This page describes the PARSE_TIMESTAMP_MICROS function in Lenses SQL.
Builds a timestamp-micros value given a datetime string representation and a date time pattern.
Available in:
Processors | SQL Studio |
---|
Sample code:
Output:
This page describes the TIMESTAMP_MICROS function in Lenses SQL.
Builds a timestamp-micros value from a long or int value.
Available in:
Processors | SQL Studio |
---|
Sample code:
Output:
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓ | ✓ |
✓ | ✓ |
✓ | ✓ |
✓ | ✓ |
✓ | ✓ |
✓ | ✓ |
✓ | ✓ |
This page describes the TIMESTAMP_MILLIS function in Lenses SQL.
Builds a timestamp-millis value from a long or int value.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the TO_DATE function in Lenses SQL.
Converts a string representation of a date into epoch value using the pattern provided.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the TIME_MILLIS function in Lenses SQL.
Builds a time-millis value from a long or int value.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the SECOND function in Lenses SQL.
Extracts the second component of an expression that is of type timestamp.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the PARSE_TIME_MILLIS function in Lenses SQL.
Builds a time-millis value given a time string representation and a time pattern.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the TO_DATETIME function in Lenses SQL.
Converts a string representation of a datetime into epoch value using the pattern provided.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the YESTERDAY function in Lenses SQL.
Returns the current date time minus 1 day.
Available in:
Processors | SQL Studio |
---|---|
Sample code:
Output:
This page describes the YEAR function in Lenses SQL.
Extracts the year component of an expression that is of type timestamp.
Available in:
Processors | SQL Studio |
---|
Sample code:
Output:
This page describes the TOMORROW function in Lenses SQL.
Returns the current date time plus 1 day.
Available in:
Processors | SQL Studio |
---|
Sample code:
Output:
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓ | ✓ |
✓ | ✓ |
This page describes the TO_TIMESTAMP function in Lenses SQL.
Converts a string representation of a date into epoch value using the pattern provided.
Converts a string using a pattern to a date and time type.
Available in:
Processors | SQL Studio |
---|
Sample code:
Output:
✓ | ✓ |