Function StoD() Foundation

Converts a character string in the format YYYYMMDD to a date value.

Syntax
StoD( <cDateString> ) --> dDate
Parameters
<cDateString>
<cDateString> is a character string of eight characters which contains a date value in the form "YYYYMMDD".
Return

The function StoD() returns the date value specified by <cDateString>. If <cDateString> is a null string or an invalid date, the function returns an empty date.

Description

The function StoD() converts a character string to a date value. The character string must be in the format ("YYYYMMDD"). The function is the counterpart of DtoS(). With StoD() date constants can be created which are independent of the current date format. That is especially meaningful with the date format SET DATE SYSTEM, since a date value under this format is dependent on the system configuration setting.

Examples
StoD()
// The example demonstrates the conversion of character strings and 
// date values with StoD() and DtoS() 

PROCEDURE Test 
   LOCAL cDate, dDate 

   cDate := "12/06/1994"            // character string 
   dDate := CtoD(cDate)             // date 

   ? DtoS( dDate )                  // result: 19941206 
   cDate := DtoS( dDate ) 

   ? StoD( cDate )                  // result: 12/06/94 

RETURN 
Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.