[fpc-pascal] DefaultFormatSettings usage
silvioprog
silvioprog at gmail.com
Tue Feb 4 15:06:01 CET 2014
2014-02-04 Dimitrios Chr. Ioannidis <d.ioannidis at nephelae.eu>:
> 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
Thank you Dimitrios!
Worked with:
var
t: TDateTime;
begin
t := StrToDateTime('2013-02-04 11:39:54');
end;
sorry, I forgot to use the function StrToDateTime. :S
--
Silvio Clécio
My public projects - github.com/silvioprog
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20140204/717a07b1/attachment.html>
More information about the fpc-pascal
mailing list