This file contains 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 epoch_to_jd(float) RETURNS int as $$ | |
BEGIN | |
return ($1 / (24*3600) + 2440588)::int; | |
END; | |
$$ LANGUAGE plpgsql; | |
create or replace function timestamp_to_jd(timestamp with time zone) RETURNS int as $$ | |
BEGIN | |
return epoch_to_jd(extract (epoch from $1)); |