Date2Num

Returns the number of days since the epoch, given a date string.

Syntax

Date2Num(d [, f [, k ]])

Parameters

Parameter

Description

d

A date string in the format supplied by f that also conforms to the locale given by k.

f (optional)

A date format string. If f is omitted, the default date format MMM D, YYYY is used.

k (optional)

A locale identifier string that conforms to the locale naming standards. If k is omitted (or is invalid), the ambient locale is used.

The function returns a value of 0 if any of the following conditions are true:

  • The format of the given date does not match the format specified in the function.

  • Either the locale or date format supplied in the function is invalid.

    Insufficient information is provided to determine a unique day since the epoch (that is, any information regarding the date is missing or incomplete).

Examples

The following expressions are examples of using the Date2Num function:

Expression

Returns

Date2Num("Mar 15, 1996")

35138

Date2Num("1/1/1900", "D/M/YYYY")

1

Date2Num("03/15/96", "MM/DD/YY")

35138

Date2Num("Aug 1,1996", "MMM D, YYYY")

35277

Date2Num("96-08-20", "YY-MM-DD", "fr_FR")

35296

Date2Num("1/3/00", "D/M/YY") - Date2Num("1/2/00", "D/M/YY")

29

// Ethnio survey code removed