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

Next Topic: DATETOSTRING Function--Convert Number to String

DATEFROMSTRING Function--Convert String to Number

The DATEFROMSTRING function accepts a string representation of a date, a time, or both and converts the string to a numeric representation. Date and time are represented numerically as the number of seconds that have passed since January 1, 1970.

Syntax

The DATEFROMSTRING function has the following format:

DATEFROMSTRING(date_time[, format_string])

Parameters

The DATEFROMSTRING function accepts the following parameters:

date_time (string)

format_string (string)

(Optional) Specifies the format of date_time. For example, the format_string "YYYYMMDD" specifies the format of "20020223." If the format_string is omitted, the function uses the default format of "YYYYMMDDhhmmss." If date_time is invalid, the function returns -1.

Return Value

The DATEFROMSTRING function returns a number.

Example

Return_value=DATEFROMSTRING('20020223')
Return_value=1024804800

More information:

DATE Function--Set to Midnight (form 1)

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

DATETOSTRING Function--Convert Number to String


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