DateTimeToStr and StrToDateTime are incompatible
- Lazarus/FPC Version: Lazarus 2.2.2 (rev lazarus_2_2_2) FPC 3.2.2 i386-win32-win32/win64
- Operating System: Windows 10 x64
- CPU / Bitness: 64 bit, program build as 32 bit
What happens
DateTimeToStr and StrToDateTime are incompatible when non-numeric month is specified in ShortDateFormat.
What did you expect
The 2 functions should be the opposite of each other.
Steps to reproduce
program project1;
uses SysUtils;
var
dt: TDateTime;
s: string;
begin
dt := Now;
ShortDateFormat := 'd/MMM/yyyy';
s := DateTimeToStr(dt);
writeln(s);
writeln(DateTimeToStr(StrToDateTimeDef(s, 0)));
readln();
end.
The output is:
1-Jun-2022 10:44:21
30-Dec-1899