Icon StrToDateTimeDef

Unit: WebCore

Available In: Client and Server Applications

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

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

Examples

A := StrToDateTimeDef('2/33/2012 12:10 PM', StrToDateTime('1/1/2012 12:00 AM'));
X := DateTimeToStr(A);  // X is '1/1/2012 12:00 AM'
Image