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 hints?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…