[fpc-pascal] Convert complicated string to DateTime
leledumbo
leledumbo_cool at yahoo.co.id
Thu Mar 5 03:53:34 CET 2009
Gabor Boros wrote:
>
> But I defined LongMonthNames in a TFormatSettings type variable and
> passed to ScanDateTime.
>
That's what you didn't tell us. I'm not sure either, perhaps a bug in
ScanDateTime. This little program shows it (got EConvertError):
uses
SysUtils,DateUtils;
var
f: TFormatSettings;
t: TDateTime;
begin
f:=DefaultFormatSettings;
f.LongMonthNames[11]:='November';
t:=ScanDateTime('mmmm dd hh:nn:ss:yyyy','November 21 09:42:21:2008',f);
WriteLn(FormatDateTime('mmmm dd hh:nn:ss yyyy',t));
end.
but surprisingly, if I change the line that calls ScanDateTime to:
t:=ScanDateTime('mmmm dd:hh:nn:ss:yyyy','November 21:09:42:21:2008',f);
it works. But then, only hh:nn:ss part returns the correct value. You may
want to post a bug report.
Btw, could you post your complete TFormatSettings? Maybe it's related
somehow.
--
View this message in context: http://www.nabble.com/Convert-complicated-string-to-DateTime-tp22317964p22344372.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
More information about the fpc-pascal
mailing list