{"id":1873,"date":"2019-11-22T12:41:17","date_gmt":"2019-11-22T12:41:17","guid":{"rendered":"http:\/\/www.theSQLReport.com\/?p=1873"},"modified":"2019-11-22T12:47:21","modified_gmt":"2019-11-22T12:47:21","slug":"teradata-convert-timestamp-to-the-day-of-the-week","status":"publish","type":"post","link":"https:\/\/www.theSQLReport.com\/?p=1873","title":{"rendered":"Teradata &#8211; Convert Timestamp to the Day of the Week"},"content":{"rendered":"<p>This surprises me that someone has not already posted this.<\/p>\n<p>The TD_Day_of_Week function returns an integer value that need to converted to string value.\u00a0 Careful when using this on a large data set, it can really slow down the response time.<\/p>\n<pre>select\r\n\r\nTD_Day_of_Week(current_date) AS \"TD_Day_of_Week Value\",\r\n\r\nCASE\r\n\r\nTD_Day_of_Week(current_date)\r\n\r\nWHEN 1 THEN 'Sunday'\r\n\r\nWHEN 2 THEN 'Monday'\r\n\r\nWHEN 3 THEN 'Tuesday'\r\n\r\nWHEN 4 THEN 'Wednesday'\r\n\r\nWHEN 5 THEN 'Thursday'\r\n\r\nWHEN 6 THEN 'Friday'\r\n\r\nWHEN 7 THEN 'Satday'\r\n\r\nEND AS \"Day of the Week\"<\/pre>\n<p><a href=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2019\/11\/Teradata_Day_ofthe_Week.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1874 size-full\" src=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2019\/11\/Teradata_Day_ofthe_Week.jpg\" alt=\"Teradata - Convert Timestamp to Day of the Week\" width=\"408\" height=\"537\" \/><\/a><\/p>\n<p>Note: If you know of a native Teradata function that does this, please leave me note in the comments.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This surprises me that someone has not already posted this. The TD_Day_of_Week function returns an integer value that need to converted to string value.\u00a0 Careful when using this on a &hellip; <a class=\"readmore\" href=\"https:\/\/www.theSQLReport.com\/?p=1873\">Continue Reading &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":1874,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[54],"tags":[177,176,174],"class_list":["post-1873","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-teradata","tag-day-of-the-week","tag-td_day_of_week","tag-timestamp"],"_links":{"self":[{"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/posts\/1873"}],"collection":[{"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1873"}],"version-history":[{"count":6,"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/posts\/1873\/revisions"}],"predecessor-version":[{"id":1886,"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/posts\/1873\/revisions\/1886"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/media\/1874"}],"wp:attachment":[{"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1873"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1873"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1873"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}