# decyear

Decimal year calculator

## Syntax

## Description

converts one or more `dy`

= decyear(`datetime`

)`datetime`

arrays to decimal year,
`dy`

. Some applications require decimal years for better precision.
For more information on decimal years and how `decyear`

calculates
them, see Algorithms.

converts one or more date vectors, `dy`

= decyear(`dateVector`

)`dateVector`

, into decimal year,
`dy`

.

converts one or more date character vectors, `dy`

= decyear(`dateCharacterVector`

,`format`

)`dateCharacterVector`

, to
decimal year using format `format`

.

and
`dy`

= decyear(`year`

,`month`

,`day`

)

return the decimal year for corresponding elements of the
`dy`

= decyear([`year`

,`month`

,`day`

])`year,month,day`

arrays.

and
`dy`

= decyear(`year`

,`month`

,`day`

,`hour`

,`minute`

,`second`

)

return the decimal year for corresponding elements of the
`dy`

= decyear([`year`

,`month`

,`day`

,`hour`

,`minute`

,`second`

])

arrays. Specify the six arguments as one-dimensional arrays of the same length or as
scalar values.`year`

,`month`

,`day`

,`hour`

,`minute`

,`second`

## Examples

## Input Arguments

## Output Arguments

## Algorithms

The `decyear`

function calculates a decimal year as a representation of
time expressed as the current year plus the time elapsed since the beginning of the current
year as a fraction of the whole year. Since there are 365 days in one common year, a tenth of
the common year is equal to 36.5 days (36 days and 12 hours).

Consider 2022.1. The .1 correlates to 36.5 days into the year 2022, which is February 6, 2022 at 12:00:00 (31 days in January + 6.5 days in February). Similarly, 2022.2 correlates to 73 days into the year 2022 (36.5 x 2), or March 15, 2022 at 00:00:00.

In a leap year, one tenth of a leap year equals 36.6 days. Thus, 2020.1 corresponds with February 6, 2020 at 14:24:00.

## Version History

**Introduced in R2006b**

## See Also

`juliandate`

| `leapyear`

| `mjuliandate`

| `datenum`

| `datestr`

| `datetime`