开发者

Converting String (in Eastern Daylight Time format) to Date in SQL

开发者 https://www.devze.com 2023-01-11 10:28 出处:网络
Please I need help on how to convert this string [ Fri Jun 19 10:45:39 EDT 2009 ] that is in EDT date format back to Date in SQL (A开发者_StackOverflow中文版m using Postgres). I want to be able to hav

Please I need help on how to convert this string [ Fri Jun 19 10:45:39 EDT 2009 ] that is in EDT date format back to Date in SQL (A开发者_StackOverflow中文版m using Postgres). I want to be able to have something like this 19-06-2009

Thanks


SELECT
    CAST('Fri Jun 19 10:45:39 EDT 2009' AS date),   -- to get datatype DATE
    TO_CHAR(CAST('Fri Jun 19 10:45:39 EDT 2009' AS date), 'DD-MM-YYYY') -- formated date, a string
0

精彩评论

暂无评论...
验证码 换一张
取 消