Search Postgresql Archives

Type to to_char(d, 'J')?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear list,

Section 9.8 of the postgres (9.1) documentation says, on the
patterns for to_char(timestamp, pattern),:

J	Julian Day (days since November 24, 4714 BC at midnight)

This leaves open the question of what's actually returned.  At least
in astronomy, it is customary to have fractional days in JDs, whereas
postgres appears to always return an integer.  Is that guaranteed
behaviour?

The reason I'm asking is that I'd like to use the expression

to_char($1, 'J')::double precision 
  + to_char($1,'ssss')::double_precision/86400 
  - 2400001

to compute the modified julian date (MJD) from a postgres timestamp
in some software that may be around for longer.  If postgres at some
point decided to return fractional days, that would blow up.


If integers are guaranteed, might I suggest to change the
documentation to read


  J	Chronological Julian Day (integer number of days since November 24, 
    4714 BC at midnight)


Cheers,

        Marc



-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux