# date_to_num (MathScript RT Module Function)

LabVIEW 2012 MathScript RT Module Help

Edition Date: June 2012

Part Number: 373123C-01

»View Product Info

Owning Class: time

Requires: MathScript RT Module

## Syntax

n = date_to_num(s)

n = date_to_num(v)

n = date_to_num(s, pivotyear)

n = date_to_num(y, m, d)

Legacy Name: `datenum`

## Description

Converts a time in string or vector format to a double-precision, floating-point number. n = date_to_num(s) is equivalent to n = date_to_num(s, -1).

Details

Examples

## Inputs

Name Description
s Specifies a time in string format.
pivotyear Provides additional information about the century if you use the form yy in s. If you specify a pivotyear, LabVIEW considers s to be a time in pivotyear or the 99 years that follow pivotyear. For example, the result of date_to_num('18-Oct-04', 1900) is equivalent to the result of date_to_num('18-Oct-1904'). However, if you do not specify pivotyear, or if pivotyear is less than 0, LabVIEW considers s to be within a century centered on the current year, or the current year plus or minus 50 years. For example, the result of date_to_num('18-Oct-04') is equivalent to the result of date_to_num('18-Oct-2004').
v Specifies a time in vector format.
y Specifies the year. y is a matrix.
m Specifies the month. m is a matrix.
d Specifies the day. d is a matrix.

## Outputs

Name Description
n Returns the time as a double-precision, floating-point number.

## Details

y, m, and d must be matrices of the same size, or any can be a scalar.

The following table lists the support characteristics of this function.

 Supported in the LabVIEW Run-Time Engine Yes Supported on RT targets Yes Suitable for bounded execution times on RT Not characterized

## Examples

N = date_to_num('18-Oct-04', 1900);
N = date_to_num('18-Oct-04');