Icon StrToDateDef

Unit: WebCore

Available In: Client and Server Applications

function StrToDateDef(const Value: String; UTC: Boolean=False;
                      DefaultValue: DateTime=DateTime(0)): DateTime

The StrToDateDef function converts the formatted local or UTC date string input parameter into its native value. The required format of the string is determined by the TFormatSettings ShortDateFormat property. If the input parameter is not a valid date string, the return value is the specified default value.

Examples

A := StrToDateDef('2/33/2012', StrToDate('1/1/2012'));
X := DateToStr(A);  // X is '1/1/2012'
Image