Apache Tajo - DateTime Functions


Advertisements

Apache Tajo supports the following DateTime functions.

S.No. Function & Description
1 add_days(date date or timestamp, int day

Returns date added by the given day value.

2 add_months(date date or timestamp, int month)

Returns date added by the given month value.

3 current_date()

Returns today’s date.

4 current_time()

Returns today’s time.

5 extract(century from date/timestamp)

Extracts century from the given parameter.

6 extract(day from date/timestamp)

Extracts day from the given parameter.

7 extract(decade from date/timestamp)

Extracts decade from the given parameter.

8 extract(day dow date/timestamp)

Extracts day of week from the given parameter.

9 extract(doy from date/timestamp)

Extracts day of year from the given parameter.

10 select extract(hour from timestamp)

Extracts hour from the given parameter.

11 select 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.

12 select extract(isoyear from date)

Extracts ISO year from the specified date. ISO year may be different from the Gregorian year.

13 extract(microseconds from time)

Extracts microseconds from the given parameter. The seconds field, including fractional parts, multiplied by 1 000 000;

14 extract(millennium from timestamp )

Extracts millennium from the given parameter.one millennium corresponds to 1000 years. Hence, the third millennium started January 1, 2001.

15 extract(milliseconds from time)

Extracts milliseconds from the given parameter.

16 extract(minute from timestamp )

Extracts minute from the given parameter.

17 extract(quarter from timestamp)

Extracts quarter of the year(1 - 4) from the given parameter.

18 date_part(field text, source date or timestamp or time)

Extracts date field from text.

19 now()

Returns current timestamp.

20 to_char(timestamp, format text)

Converts timestamp to text.

21 to_date(src text, format text)

Converts text to date.

22 to_timestamp(src text, format text)

Converts text to timestamp.

Advertisements