By using this site, you acknowledge that you have read and understand our Cookie policy, Privacy policy and Terms .
close

Code snippets for various programming languages/frameworks.

rss_feed Subscribe RSS

This code snippet shows how to convert string to date.

In Teradata, CAST function can be used to cast string/varchar to date. Format string can be used. For example, B represents blank/space while YYYY represents years.

Code snippet

SELECT CAST('2017-10-15' AS DATE FORMAT 'YYYY-MM-DD');

SELECT CAST('2017 10 15' AS DATE FORMAT 'YYYYBMMBDD');

SELECT CAST('2017 Oct 15' AS DATE FORMAT 'YYYYBMMMBDD');

SELECT CAST('15, Oct, 2017' AS DATE FORMAT 'DD,BMMM,BYYYY');

-- default ansi format

SELECT CAST('2017-10-15' AS DATE);

-- use to_date function

SELECT to_date('2017-10-15', 'YYYY-MM-DD');
info Last modified by Raymond at 10 months ago * This page is subject to Site terms.

info About author

More from Kontext

local_offer teradata local_offer SQL

visibility 45
thumb_up 0
access_time 4 months ago

This code snippet shows how to calculate time differences.

open_in_new View

local_offer teradata local_offer spark local_offer pyspark

visibility 1823
thumb_up 0
access_time 8 months ago

In my article Connect to Teradata database through Python , I demonstrated about how to use Teradata python package or Teradata ODBC driver to connect to Teradata. In this article, I’m going to...

open_in_new View

local_offer teradata local_offer SQL

visibility 75
thumb_up 0
access_time 4 months ago

JSON is commonly used in modern applications for data storage and transfers. Pretty much all programming languages provide APIs to parse JSON. 

open_in_new View

local_offer SQL local_offer hive

visibility 70
thumb_up 0
access_time 4 months ago

In Oracle database, you can select from dual table if you only want to return a one row result set. In many other databases, the query engine supports select directly from constant values without specifying a table name. 

open_in_new View

Kontext Column

Kontext Column

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

Learn more arrow_forward
info Follow us on Twitter to get the latest article updates. Follow us