The underlying Impala data types for date and time data are
Some of the date/time functions are affected by the setting of the
Function reference:
Impala supports the following date and time functions:
Return type:
Same as
The
Return type:
Any references to the
Return type:
Return type:
Return type:
The following examples show the shorthand notation of an
Like all date/time functions that deal with months,
Return type:
Return type:
Return type:
The following example shows the simplest usage, of subtracting a specified number of
days from a
The following examples show the shorthand notation of an
Like all date/time functions that deal with months,
Argument: The
Although this function is similar to calling
This function is typically used in
Return type:
Examples:
If
If
If
Return type:
Usage notes:
The time portions of the
Returns
Return type:
Return type:
Return type:
Return type:
Return type:
Return type:
Argument: The
Typically used in
Return type:
If you specify
Return type:
The
Because Impala implicitly converts string values into
The allowed tokens for the pattern string are the same as for the
Return type:
The
The following rules apply to the
In Impala 1.3 and later, you can switch the order of elements, use
alternative separator characters, and use a different number of placeholders for each
unit. Adding more instances of
A date string including all fields could be
Return type:
Usage notes: Often used to translate UTC time zone data stored in a table
back to the local date and time for reporting. The opposite of the
See discussion of time zones in
Return type:
Return type:
Return type:
Return type:
Typically used in business contexts, for example to determine whether a specified number of months have passed or whether some end-of-month deadline was reached.
The method of determining the number of elapsed months includes some special
handling of months with different numbers of days that creates edge cases for dates
between the 28th and 31st days of certain months. See
If either value is
If the first argument represents an earlier time than the second argument, the result is negative.
Return type:
If the input argument does not represent a valid Impala
Return type:
Return type:
Return type:
The millisecond value is truncated, not rounded, if the
Return type:
Return type:
Return type:
Return type:
Return type:
Return type:
Return type:
Return type:
Usage notes:
If
Return type:
Typically used in business contexts, for example to determine whether a specified number of months have passed or whether some end-of-month deadline was reached.
If the only consideration is the number of full months and any fractional value is
not significant, use
The method of determining the number of elapsed months includes some special handling of months with different numbers of days that creates edge cases for dates between the 28th and 31st days of certain months.
If either value is
If the first argument represents an earlier time than the second argument, the result is negative.
The time portion of the input arguements are ignored.
Return type:
Usage notes:
If
Return type:
Return type:
Argument: The
The following values are accepted for
Return type:
Return type:
To find a date/time value in the future or the past relative to the current date and
time, add or subtract an
To produce a
Any references to the
Return type:
Return type:
Return type:
Return type:
The
Return type:
Return type:
Usage notes: The result value represents similar information as the
If the first argument represents a later point in time than the second argument, the result is 1.
If the first argument represents an earlier point in time than the second argument, the result is -1.
If the first and second arguments represent identical points in time, the result is 0.
If either argument is
Return type:
Usage notes: A comparison function for
Return type:
Return type:
An integer argument represents the number of seconds past the epoch (midnight on
January 1, 1970). It is the converse of the
A string argument, plus another string argument representing the pattern, turns an
arbitrary string representation of a date and time into a true
The following examples demonstrate how to convert an arbitrary string representation
to
The following examples show how to convert a
Return type:
Often used in combination with the
See discussion of time zones in
The simplest use of this function is to turn a local date/time value to one with the
standardized UTC time zone. Because the time zone specifier is not saved as part of
the Impala
Once a value is converted to the UTC time zone by
Argument: The
Added in: The ability to truncate numeric values is new starting in
The
Return type:
Example:
Return type:
See
In Zulu
time, a synonym for UTC.
In
The following examples show different ways of turning the same date and time into an
integer value. A
The final two examples show how to specify a timezone offset of Pacific Daylight
Saving Time, which is 7 hours earlier than UTC. You can use the numeric offset
Return type:
Similar to the
For working with date/time values represented as integer values, you can convert
back and forth between
The following example shows how
Return type:
Return type:
Return type:
Return type:
Return type:
Usage notes:
If the equivalent date does not exist in the year of the result due to a leap year, the date is changed to the last day of the appropriate month.
Return type:
Usage notes:
If the equivalent date does not exist in the year of the result due to a leap year, the date is changed to the last day of the appropriate month.