Examples - Analytics Database - Teradata Vantage

SQL Date and Time Functions and Expressions

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2023-10-30
dita:mapPath
cpk1628111786971.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
pxz1544241488545
lifecycle
latest
Product Category
Teradata Vantage™

Usage examples:

SELECT HOUR(CURRENT_TIMESTAMP(6));
SELECT MINUTE(CURTIME());
SELECT SECOND('12:34:25');
sel dayofmonth(current_timestamp);
sel dayofmonth(date '2017-08-21');
sel dayofmonth(timestamp '2017-08-21 16:48:27.770000+00:00');
sel dayofmonth('2017-08-21 16:48:27.770000+00:00' (timestamp));
sel dayofmonth(date '1900-01-01');
sel dayofmonth(date '2018-02-22' - interval '300' year);
sel dayofmonth(date '2018-02-22' - interval '6' month);
sel dayofmonth(date '2018-02-22' - interval '15' day);
sel week(date);
sel week(current_date);
sel week(date '1900-01-01');
sel week(date '1700-05-31');
sel week(date - interval '300' year);
sel week(date - interval '6' month);
sel week(date - interval '150' day);
sel month(date);
sel month(current_date);
sel month(date '1900-01-01');
sel month(date '1899-12-31');
sel month(date '1700-05-31');
sel month(date - interval '300' year);
sel month(date - interval '6' month);
sel month(date - interval '150' day);
sel year(date);
sel year(current_date);
sel year(date '1900-01-01');
sel yearmonth(date '1899-12-31');
sel year(date - interval '300' year);
sel year(date - interval '6' month);