Convert TimeStamp to Date in Teradata

access_time 2 months ago visibility39 comment 0

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.
Like this article?
Share on

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts

Want to publish your article on Kontext?

Learn more

Kontext Column

Created for everyone to publish data, programming and cloud related articles.
Follow three steps to create your columns.


Learn more arrow_forward

More from Kontext

local_offer teradata local_offer C# local_offer .NET

visibility 7993
thumb_up 0
access_time 6 years ago

In this post, I will demonstrate how to connect to Teradata database via .NET Data Provider for Teradata using C#. Install the .NET Data Provider for Teradata from the following link: Teradata Tools and Utilities Windows Installation Package Name it as’' ‘ConsoleApps.Teradata’. Add ...

local_offer teradata local_offer SQL

visibility 23
thumb_up 0
access_time 2 months ago

A procedure contains a number of SQL statements that will be executed in sequence in Teradata. Procedures can be used to return result sets to the invoking clients. In many other databases, it is very easy to return set records to the client in a procedure as SELECT statement can be directly used.

local_offer teradata local_offer SQL

visibility 141
thumb_up 1
access_time 8 months ago

COALESCE function in Teradata returns NULL if all arguments evaluate to null; otherwise it returns the value of the first non-null argument. NULLIF is to used evaluate two expressions and returns NULL if the two arguments are equal otherwise if returns the first arguments. IS NULL is used to ...

About column

Tutorials and information about Teradata.

rss_feed Subscribe RSS