17.10 - Examples - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Date and Time Functions and Expressions

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1211-171K
Language
English (United States)

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.