Convert TimeStamp to Date in Teradata
Current timestamp
Function CURRENT_TIMESTAMP can be used to retrieve the current timestamp:
SELECT CURRENT_TIMESTAMP;
Sample output:
20/09/2020 20:55:35.390000-04:00
Convert TimeStamp to Date
Function CAST can be used to convert TimeStamp to DATE.
SELECT CAST(CURRENT_TIMESTAMP AS DATE)
Sample output:
20/09/2020
Convert Date to TimeStamp
SELECT CAST(CURRENT_DATE AS TIMESTAMP(6));
Sample output:
20/09/2020 00:00:00.000000
Convert Varchar to TimeStamp
SELECT CAST('2017-10-15 23:59:59.999999 +10:00' AS TIMESTAMP(6) WITH TIME ZONE FORMAT 'YYYY-MM-DDBHH:MI:SS.S(6)BZ');
Sample output:
15/10/2017 23:59:59.999999+10:00
More examples
Refer to Teradata Tutorial – DateTime Related Functions and Examples for more example about Teradata DATE and TIME related function.
copyright
This page is subject to Site terms.
comment Comments
No comments yet.
Log in with external accounts
warning Please login first to view stats information.
article
Teradata SQL - Use OREPLACE to Replace or Remove Characters
article
[C#] Connect to Teradata Database via .NET Data Provider
article
Connect to Teradata database through Python
article
Querying Teradata and SQL Server - Tutorial 0: Preparation
article
Load CSV into Teradata via TPT
Read more (73)