YMDHMS2DT

Purpose:

Converts years, months, days, hours, minutes and seconds to date and time values.

Syntax:

YMDHMS2DT(years, months, days, hours, minutes, seconds)

(date, time) = YMDHMS2DT(years, months, days, hours, minutes, seconds)

years

-

A scalar or series, the year values.

months

-

A scalar or series, the month values.

days

-

A scalar or series, the day values.

hours

-

A scalar or series, the hours values.

minutes

-

A scalar or series, the minutes values.

seconds

-

A scalar or series, the seconds values.

Returns:

A datetime series where the data and time values are in two adjacent columns.

 

(date, time) = YMDHMS2DT(years, months, days, hours, minutes, seconds) returns the date and time in two separate variables.

Example:

W1: ymdhms2dt()

 

W1 contains the current datetime.

Example:

W1: ymdhms2dt(2028, 1, 2, 12, 0, 0)

W2: ymdhms2dt(2028, 3, 1, 12, 0, 0)

W3: dtduration(w2, w1)

W4: dtoffset(w1, w3)

 

Same as the first example, except the end and start year is 2028, a leap year. The duration is 5097600 seconds. The duration has increased by 86400 seconds from 5011200 seconds to 5097600 because of the leap year.

Example:

W2: ymdhms2dt(2030, 10, 31, 12, 0, 0)

 

W2 contains the datetime series:

10/31/2030 12:00:00

Example:

(d, t) = ymdhms2dt(2030, 10, 31, 12, 0, 0)

 

Same as above, except the date and time are returned to the variables d and t.

Example:

W3: ymdhms2dt(2030, 10, 32, 12, 0, 70)

 

W3 contains the datetime series:

11-01-2030 12:01:10

 

The day value wraps around and the seconds value wraps around.

Example:

W4: ymdhms2dt(2030..2034, 4, 1..5, 12, 10..14, 0)

 

W4 contains the datetime values:

4/01/2030 12:10:00

4/02/2031 12:11:00

4/03/2032 12:12:00

4/04/2033 12:13:00

4/05/2034 12:14:00

Example:

W1: gnorm(10, hours2seconds(2) + minutes2seconds(10) + 13.5)

W2: getdt(w1)

W3: dtduration(w2)

W4: w3;setvunits("Real Time")

 

W1 contains 10 random samples with a time spacing of 7813.5 seconds or 2 hours 10 minutes and 13.5 seconds between samples.

 

W2 computes the datetime values for each sample in W1.

 

Because only one datetime series was given, W3 computes the two-point difference between subsequent samples of W2. The result is 7813.5 seconds for each sample, equal to the original sample spacing of the series in W1.

 

W4 displays the durations in W3 in wall-clock time. The values conform to the time spacing of W1.

Remarks:

YMDHMS2DT converts years, months, days, hours, minutes and seconds to a datetime series.

 

A datetime series consists of 2 columns of values where the first column contains integer Julian dates starting at midnight and the second column contains time in seconds starting from midnight.

 

See DT2YMDHMS to convert a date time series to series of years, months, days, hours, minutes, seconds.

See Also:

DT2TIMESTAMP

DT2YMDHMS

DTDURATION

DTPERIOD

GETDT

TIMESTAMP2DT

YMD2DATE