TIME Function Examples | VantageCloud Lake - Examples: TIME Function - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
ft:locale
en-US
ft:lastEdition
2024-12-11
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

Example: Returning the Current Time Based on Time Zone String, 'America Pacific'

The following queries return the current time at the time zone displacement based on the time zone string, 'America Pacific'. The time returned is automatically adjusted to account for the start and end of daylight saving time.

SELECT TIME AT TIME ZONE 'America Pacific';
SELECT TIME AT 'America Pacific';

Example: Displaying Hundredths of a Second

The hundredths of a second are not displayed by the default format, but you can use the FORMAT phrase to display it:

SELECT TIME (FORMAT '99:99:99.99');

The system responds with something like the following:

       Time
-----------
16:26:30.19

Example: Inserting a Row in a Table

The following example inserts a row in a hypothetical table in which the column InsertTime has data type FLOAT and records the time that the row was inserted:

   INSERT INTO HypoTable (ColumnA, ColumnB, InsertTime) 
   VALUES ('Abcde', 12345, TIME);