I have this table our_table in PostgreSQL, and I am attempting to convert this value column, which is a string, into a timestamp with to_timestamp. The 10 rows showing in the screenshot are all 10 rows of this table. I have the query:
select
*,
case when value like 'AM' then to_timestamp(value, 'MM/DD/YYYY-HH:MI AM') else to_timestamp(value, 'MM/DD/YYYY-HH:MI PM') end as tmp
from our_table
...and I receive the error ERROR: invalid value for "MM" in source string. I noticed that value was type varchar(6000), and I attempted to convert it into varchar(2048) before using to_timestamp however this did not help.
How can I turn this string column into timestamp using to_timestamp? I have checked thoroughly and the first two digits are always, 01, 02, 03, ..., 11, or 12, with no other values, so it is odd that I receive the error I am getting. I'm not sure if this is a type issue or something else then. Appreciate any help!
