Conversion with StrToDateTime and TFormatSettings does not work
问题 This code should work in Delphi XE2, but it gives "not a valid date and time" error in StrtoDateTime conversion: procedure TForm2.Button1Click(Sender: TObject); var s: string; d: TDateTime; FmtStngs: TFormatSettings; begin GetLocaleFormatSettings(GetThreadLocale, FmtStngs); FmtStngs.DateSeparator := #32; FmtStngs.ShortDateFormat := 'dd mmm yyyy'; FmtStngs.TimeSeparator := ':'; FmtStngs.LongTimeFormat := 'hh:nn'; s := FormatDateTime('', Now, FmtStngs); d := StrToDateTime(s, FmtStngs); end; Any