toArray Function

Top  Previous  Next

Breaks a date/time value into components such as year, month, hour, etc.

Syntax

DateTime.toArray(date)

Arguments

dateAn integer that is a date/time value.

Return Value

An array with 7 elements. Each element is a component of the date/time value, as shown below:

 

Index

Value

Range

0

year

0 or 1980 - 2099

1

month

0 - 11

2

day

0 or 1 -31

3

hour

0 - 23

4

minute

0 - 59

5

second

0 - 59

6

weekday

0 - 6

Remarks

The year and day elements (index 0 and 2, respectively) will be zero if the date/time value is only a time.

 

This function can be used to provide custom formatting of date/time. Note that if a numeric month is to be displayed, add one to the month element value. The monthName and dayName functions can be used to display month and weekday (respectively) by name.

Examples

DateTime.toArray()