A B
203105144092 02/14/2015
203105144092 2015-08-10
203105144092 2015-08-03
203105144092 05/11/2015
203105144092 09/30/2014
如何将B col转换为yyyy-MM-DD
答案 0 :(得分:0)
在您的情况下,您可以使用隐式CAST到DATE的组合,然后使用TO_CHAR函数,如下所示:
TESTDB.ADMIN(ADMIN)=> TESTDB.ADMIN(ADMIN)=> select col, to_char(col::date,'YYYY-MM-DD') from date_test;
COL | TO_CHAR
------------+------------
05/11/2015 | 2015-05-11
02/14/2015 | 2015-02-14
2015-08-10 | 2015-08-10
2015-08-03 | 2015-08-03
09/30/2014 | 2014-09-30
(5 rows)