Previous Topic: DATE Function--Set to Midnight (form 1)

Next Topic: DATEFROMSTRING Function--Convert String to Number

DATE Function--Convert Year, Month, Day, Hours, Minutes, and Seconds (form 2)

The DATE function (form 2) accepts six numbers that represent the year, month, day, hours, minutes, and seconds and converts them to a numeric representation of date and time. Date and time are represented numerically as the number of seconds that have passed since January 1, 1970. If the three time parameters are omitted, the function sets the time to midnight on the specified date.

Syntax

The DATE function (form 2) has the following format:

DATE(year, month, day[, hours, minutes, seconds])

Parameters

The DATE function (form 2) accepts the following parameters:

year (number)

Specifies a four-digit representation of the year.

Example: 2007

month (number)

Specifies the month.

Range: 1-12

day (number)

Specifies the day.

Range: 1-31

hours (number)

(Optional) Specifies the number of hours.

Range: 0-23

minutes (number)

(Optional) Specifies the number of minutes.

Range: 0-59

seconds (number)

(Optional) Specifies the number of seconds.

Range: 0-59

Return Value

The DATE function (form 2) returns a number.

More information:

DATE Function--Set to Midnight (form 1)

DATEFROMSTRING Function--Convert String to Number

DATETOSTRING Function--Convert Number to String


Copyright © 2010 CA. All rights reserved. Email CA about this topic