I have csv files loaded into a DBeaver postgres database with the dates expressed as 5 digits. (41827, 35267, 39444, etc.)
I know these are formatted in Excel as the number of days since Jan 1, 1900. Is there a query I can write in my editor to convert those into a mm/dd/yyyy?
I’ve tried using a SELECT/INTERVAL/CAST type of function but cant quite figure out the syntax.
Example: Schema: profiles,
Column name: date_activated,
Cell value: 41827(varchar)
Excel dates represent the number of days since December 30th, 1899 (well, approximatly – early years are inaccurate).
In Postgres you could do:
date '1899-12-30' + myexceldate::int * interval '1' day
myexceldate is the name of the text column that holds the excel number.