Sample Header Ad - 728x90

Enterprisedb, PostgreSQL cast to date

2 votes
1 answer
475 views
How to cast **'2015-11-13 00:00:00'** (*text or timestamp*) to **'2015-11-13'**(*date*) in Enterprisedb (EDB) ? With 4 queries below: 1/ SELECT '2015-11-13 00:00:00'::date ; --> result: "2015-11-13" 2/ SELECT date ( '2015-11-13 00:00:00' ) ; 3/ SELECT cast ( '2015-11-13 00:00:00' as date) ; 4/ SELECT to_char('2015-11-13 00:00:00'::timestamp, 'yyyy-mm-dd'::text); In EDB 9.3 , just one query no.4 can cast. And PG 9.3 , all queries can do. Are there still any ways to cast date in EDB ? **EDIT**: With EDB : 1/ SELECT '2015-11-13 00:00:00'::date ; --> result: "2015-11-13 00:00:00" 2/ SELECT date ( '2015-11-13 00:00:00' ) ; --> result: "2015-11-13 00:00:00" 3/ SELECT cast ( '2015-11-13 00:00:00' as date) ; --> result: "2015-11-13 00:00:00" 4/ SELECT to_char('2015-11-13 00:00:00'::timestamp, 'yyyy-mm-dd'::text); --> result: "2015-11-13"
Asked by Luan Huynh (2010 rep)
Nov 13, 2015, 10:13 AM
Last activity: Jan 21, 2023, 11:01 AM