# juliandate

Julian date calculator

## Syntax

``jd = juliandate(datetime)``
``jd = juliandate(dateVector)``
``jd = juliandate(dateCharacterVector,format)``
``jd = juliandate(year,month,day)``
``jd = juliandate([year,month,day],'Action'=value)``
``jd = juliandate(year,month,day,hour,minute,second,'Action'=value)``
``jd = juliandate([year,month,day,hour,minute,second],'Action'=value)``

## Description

example

````jd = juliandate(datetime)` converts one or more `datetime` arrays to Julian date, `jd`. `jd = juliandate(dateVector)` converts one or more date vectors, `dateVector`, to Julian date, `jd`. `jd = juliandate(dateCharacterVector,format)` converts one or more date character vectors, `dateCharacterVector`, to Julian date, `jd`, using format `format`. ```

example

````jd = juliandate(year,month,day)` and `jd = juliandate([year,month,day],'Action'=value)` return the Julian date for corresponding elements of the `year,month,day` arrays. `jd = juliandate(year,month,day,hour,minute,second,'Action'=value)` and `jd = juliandate([year,month,day,hour,minute,second],'Action'=value)` return the Julian date for corresponding elements of the `year,month,day,hour,minute,second` arrays. Specify the six arguments as 1-D arrays of the same length or scalar values.```

## Examples

collapse all

Calculate the Julian date for February 4, 2016, from datetime array.

`dt = datetime('04-02-2016','InputFormat','dd-MM-yyyy')`
```dt = datetime 04-Feb-2016 ```
`jd = juliandate(dt)`
```jd = 2.4574e+06 ```

Calculate Julian date for May 24, 2005, using date character version and `dd-mm-yyyy` format.

`jd = juliandate('24-May-2005','dd-mmm-yyyy')`
```jd = 2.4535e+06 ```

Calculate Julian date for December 19, 2006, from year, month, and day inputs.

`jd = juliandate(2006,12,19)`
```jd = 2.4541e+06 ```

Calculate Julian date for October 10, 2004, at 12:21:00 p.m. from year, month, day, hour, month, and second inputs.

`jd = juliandate(2004,10,10,12,21,0)`
```jd = 2.4533e+06 ```

## Input Arguments

collapse all

`datetime` array, specified as an m-by-1 array or 1-by-m array.

Full or partial date vector, specified as an m-by-6 or m-by-3 matrix containing m full or partial date vectors, respectively:

• Full date vector — Contains six elements specifying the year, month, day, hour, minute, and second

• Partial date vector — Contains three elements specifying the year, month, and day

Data Types: `double`

Date character vector, specified as a character array, where each row corresponds to one date, or a 1-D cell array of character vectors.

Data Types: `char` | `string`

Date format, specified as a character vector, string scalar, or integer. All dates in `dateCharacterVector` must have the same format and use the same date format symbols as the `datenum` function.

`juliandate` does not accept formats containing the letter `Q`.

Data Types: `char` | `string`

Year, specified as a positive scalar or 1-D array.

#### Dependencies

Depending on the syntax, specify `year`, `month`, and `day` or `year`, `month`, `day`, `hour`, `minute`, and `second` as 1-D arrays of the same length or scalar values.

Data Types: `char` | `string`

Month, specified as a positive or negative scalar or 1-D array.

#### Dependencies

Depending on the syntax, specify `year`, `month`, and `day` or `year`, `month`, `day`, `hour`, `minute`, and `second` as 1-D arrays of the same length or scalar values.

Data Types: `double`

Day, specified as a positive or negative scalar or 1-D array.

#### Dependencies

Depending on the syntax, specify `year`, `month`, and `day` or `year`, `month`, `day`, `hour`, `minute`, and `second` as 1-D arrays of the same length or scalar values.

Data Types: `double`

Hour, specified as a positive or negative scalar or 1-D array.

#### Dependencies

Depending on the syntax, specify `year`, `month`, and `day` or `year`, `month`, `day`, `hour`, `minute`, and `second` as 1-D arrays of the same length or scalar values.

Data Types: `double`

Minute, specified as a positive or negative scalar or 1-D array.

#### Dependencies

Depending on the syntax, specify `year`, `month`, and `day` or `year`, `month`, `day`, `hour`, `minute`, and `second` as 1-D arrays of the same length or scalar values.

Data Types: `double`

Second, specified as a positive or negative scalar or 1-D array.

#### Dependencies

Depending on the syntax, specify `year`, `month`, and `day` or `year`, `month`, `day`, `hour`, `minute`, and `second` as 1-D arrays of the same length or scalar values.

Data Types: `double`

Action for noninteger decimal date input for `year`, `month`, `day`, `hour`, and `minute`, specified as:

• `'Error'` — Displays error and total number of noninteger date values.

• `'Warning'` — Displays warning and total number of adjusted noninteger date values. The function adjusts the noninteger value to its integer equivalent before calculating the value.

• `'None'` — Does not display warning or error. The function adjusts the noninteger value to its integer equivalent before calculating the value.

Data Types: `char` | `string`

## Output Arguments

collapse all

Julian date, returned as a column vector of m Julian dates, which are the number of days and fractions since noon Universal Time on January 1, 4713 BCE.

• m-by-6 column vector — Contains six elements specifying the year, month, day, hour, minute, and second

• m-by-3 column vector — Contains three elements specifying the year, month, and day

• Row or column vector — Contains m Julian dates

#### Dependencies

The output format depends on the input format:

Input Syntax`dy` Format
```jd = juliandate(dateVector)```m-by-6 column vector or m-by-3 column vector of m Julian dates.
```jd = juliandate(dateCharacterVector,format)```Column vector of m Julian dates, where m is the number of character vectors in `dateCharacterVector`.

## Limitations

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

## Version History

Introduced in R2006b

expand all