juliandate

Converts dates to Julian dates.

Category: Language Fundamentals > Data Types

Syntax

jd = juliandate(t)

Returns the Julian date of each element of the datetime array t.

Description

The Julian date is a continuous count of days used in astronomy. Its day starts at noon, so midnight corresponds to a fraction of .5. The date and time 2000-01-01 12:00 is exactly 2451545, a common reference epoch.

Subtracting two Julian dates gives the elapsed days directly, without calendar rules.

Input arguments

t
datetime array.

Output arguments

jd
Double array the same size as t: days, with fraction, since noon on January 1, 4713 BC.

Example

The J2000 epoch

juliandate(datetime(2000,1,1,12,0,0))
juliandate(datetime(2000,1,2,12,0,0)) - juliandate(datetime(2000,1,1,12,0,0))
Output
ans = 2451545
ans = 1

See also

datenum datetime posixtime