[fpc-pascal] DefaultFormatSettings usage
Dimitrios Chr. Ioannidis
d.ioannidis at nephelae.eu
Tue Feb 4 15:00:51 CET 2014
Hi,
Στις 4/2/2014 3:54 μμ, ο/η silvioprog έγραψε:
> Hello,
>
> I'm using this configuration:
>
> initialization
> DefaultFormatSettings.DateSeparator := '-';
> DefaultFormatSettings.TimeSeparator := ':';
> DefaultFormatSettings.ShortDateFormat := 'yyyy-mm-dd';
> DefaultFormatSettings.ShortTimeFormat := 'hh:nn:ss';
>
> but, when i try:
>
> var
> t: TDateTime;
> begin
> t := StrToDate('2013-02-04 11:39:54'); // to format yyyy-mm-dd hh:nn:ss
> end;
>
> result: "2013-02-04 11:39:54" is not a valid date format.
Try the overload StrToDate(S, DefaultFormatSettings), or better declare
a FFormatSettings: TFormatSettings setup it as you like pass that to the
StrToDate leaving the DefaultFormatSettings.
Regards,
--
Dimitrios Chr. Ioannidis
More information about the fpc-pascal
mailing list