Main Content


Julian date calculator


jd = juliandate(v)
jd = juliandate(s,f)
jd = juliandate(y,mo,d)
jd = juliandate([y,mo,d])
jd = juliandate(y,mo,d,h,mi,s)
jd = juliandate([y,mo,d,h,mi,s])


jd = juliandate(v) converts one or more date vectors, v, into Julian date, jd. Input v can be an m-by-6 or m-by-3 matrix containing m full or partial date vectors, respectively. juliandate returns a column vector of m Julian dates, which are the number of days and fractions since noon Universal Time on January 1, 4713 BCE.

A date vector contains six elements, specifying year, month, day, hour, minute, and second. A partial date vector has three elements, specifying year, month, and day. Each element of v must be a positive double-precision number.

jd = juliandate(s,f) converts one or more dates, s, into Julian date, jd, using format f. s can be a character array, where each row corresponds to one date character vector, or a one-dimensional cell array of character vectors. juliandate returns a column vector of m Julian dates, where m is the number of character vectors in s.

All of the dates in s must have the same format f, composed of the same date format symbols as datestr. juliandate does not accept formats containing the letter Q.

If the format does not contain enough information to compute a date number, then:

  • Hours, minutes, and seconds default to 0.

  • Days default to 1.

  • Months default to January.

  • Years default to the current year.

Dates with two-character years are interpreted to be within 100 years of the current year.

jd = juliandate(y,mo,d) and jd = juliandate([y,mo,d]) return the decimal year for corresponding elements of the y,mo,d (year,month,day) arrays. Specify y, mo, and d as one-dimensional arrays of the same length or scalar values.

jd = juliandate(y,mo,d,h,mi,s) and jd = juliandate([y,mo,d,h,mi,s]) return the Julian dates for corresponding elements of the y,mo,d,h,mi,s (year,month,day,hour,minute,second) arrays. Specify the six input arguments as either one-dimensional arrays of the same length or scalar values.


Calculate Julian date for May 24, 2005:

jd = juliandate('24-May-2005','dd-mmm-yyyy')
jd =


Calculate Julian date for December 19, 2006:

jd = juliandate(2006,12,19)
jd =


Calculate Julian date for October 10, 2004, at 12:21:00 p.m.:

jd = juliandate(2004,10,10,12,21,0)
jd =


Assumptions and Limitations

This function is valid for all common era (CE) dates in the Gregorian calendar.

The calculation of Julian date does not take into account leap seconds.

Introduced in R2006b