Decimal year calculator
dy = decyear(v)
dy = decyear(s,f)
dy = decyear(y,mo,d)
dy = decyear([y,mo,d])
dy = decyear(y,mo,d,h,mi,s)
dy = decyear([y,mo,d,h,mi,s])
dy = decyear(v)
converts
one or more date vectors, v
, into decimal year, dy
.
Input v
can be an m
-by-6 or m
-by-3
matrix containing m
full or partial date vectors,
respectively. decyear
returns a column vector
of m
decimal years.
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.
dy = decyear(s,f)
converts
one or more date character vectors, s
, to decimal
year, dy
, using format f
. s
can
be a character array, where each row corresponds to one date, or a
one-dimensional cell array of character vectors. decyear
returns
a column vector of m
decimal years, 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 the datestr
function. decyear
does
not accept formats containing the letter Q
.
If a 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.
dy = decyear(y,mo,d)
and dy = decyear([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.
dy = decyear(y,mo,d,h,mi,s)
and dy = decyear([y,mo,d,h,mi,s])
return the
decimal year for corresponding elements of the y,mo,d,h,mi,s
(year,month,day,hour,minute,second)
arrays. Specify the six arguments as one-dimensional arrays of the
same length or scalar values.
Calculate decimal year for May 24, 2005:
dy = decyear('24-May-2005','dd-mmm-yyyy') dy = 2.0054e+003
Calculate decimal year for December 19, 2006:
dy = decyear(2006,12,19) dy = 2.0070e+003
Calculate decimal year for October 10, 2004, at 12:21:00 p.m.:
dy = decyear(2004,10,10,12,21,0) dy = 2.0048e+003
The calculation of decimal year does not take into account leap seconds.