I am having issues with converting a string into a date. The issue is that the format of the string does not easily convert to a date. For example, all the dates are set up like APR-19, or JAN-21. I am not sure how to properly cast this. Here is the SQL I am using.
Select* to_date(wbr_global.gl_ap_details,period_name,'MON-YY') from wbr_global.gl_ap_details where wbr_global.gl_ap_details.ledger_name = 'Amazon.com, Inc.' and cost_center in ('1168','1172','1092','1153','1257','1093','1705')
Advertisement
Answer
in PostgreSQL it is easy:
SELECT to_date('APR-19', 'MON-YY');
returns 2019-04-01
SELECT to_date('JAN-21', 'MON-YY');
returns 2021-01-01