Created
March 23, 2024 08:39
-
-
Save mastersign/3b188d954098dcf828e48cc847fe2f6a to your computer and use it in GitHub Desktop.
PostgreSQL function for converting timestamps into OLE Dates
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE OR REPLACE FUNCTION excel_time(in timestamp, out double precision) | |
| AS $$ | |
| SELECT (EXTRACT(epoch FROM $1) / 86400) + 25569 | |
| $$ | |
| LANGUAGE SQL IMMUTABLE PARALLEL SAFE; | |
| CREATE OR REPLACE FUNCTION excel_time(in timestamptz, out double precision) | |
| AS $$ | |
| SELECT (EXTRACT(epoch FROM $1) / 86400) + 25569 | |
| $$ | |
| LANGUAGE SQL IMMUTABLE PARALLEL SAFE; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment