Apache Tajo – DateTime Functions

Apache Tajo supports the following DateTime functions.

S.No.Function & Description
1add_days(date date or timestamp, int dayReturns date added by the given day value.
2add_months(date date or timestamp, int month)Returns date added by the given month value.
3current_date()Returns today’s date.
4current_time()Returns today’s time.
5extract(century from date/timestamp)Extracts century from the given parameter.
6extract(day from date/timestamp)Extracts day from the given parameter.
7extract(decade from date/timestamp)Extracts decade from the given parameter.
8extract(day dow date/timestamp)Extracts day of week from the given parameter.
9extract(doy from date/timestamp)Extracts day of year from the given parameter.
10select extract(hour from timestamp)Extracts hour from the given parameter.
11select extract(isodow from timestamp)Extracts day of week from the given parameter. This is identical to dow except for Sunday. This matches the ISO 8601 day of the week numbering.
12select extract(isoyear from date)Extracts ISO year from the specified date. ISO year may be different from the Gregorian year.
13extract(microseconds from time)Extracts microseconds from the given parameter. The seconds field, including fractional parts, multiplied by 1 000 000;
14extract(millennium from timestamp )Extracts millennium from the given parameter.one millennium corresponds to 1000 years. Hence, the third millennium started January 1, 2001.
15extract(milliseconds from time)Extracts milliseconds from the given parameter.
16extract(minute from timestamp )Extracts minute from the given parameter.
17extract(quarter from timestamp)Extracts quarter of the year(1 – 4) from the given parameter.
18date_part(field text, source date or timestamp or time)Extracts date field from text.
19now()Returns current timestamp.
20to_char(timestamp, format text)Converts timestamp to text.
21to_date(src text, format text)Converts text to date.
22to_timestamp(src text, format text)Converts text to timestamp.

Leave a Reply