Examples - Advanced SQL Engine - Teradata Database

SQL Date and Time Functions and Expressions

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-24
dita:mapPath
xmd1556127764262.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1211
lifecycle
previous
Product Category
Teradata Vantageā„¢

Example: Querying for DATE for the Last Day of the Month

The following query:

SELECT LAST_DAY(DATE '2009-12-20'); 

returns the result 09/12/31.

Example: Querying for TIMESTAMP for the Last Day of the Month

The following query:

SELECT LAST_DAY(TIMESTAMP '2009-08-25 10:14:59'); 

returns the result 09/08/31.

Example: Querying for TIMESTAMP WITH TIME ZONE for the Last Day of the Month

The following query:

SELECT LAST_DAY(TIMESTAMP '2009-06-15 10:14:59-8:00');

returns the result 09/06/30.