Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2000-11

StrToDateTime bug

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Pavel Stingl

Hi, I have found possible bug in SysUtils unit -
function StrToDateTime returns null date ->
this piece of code

---
var
  D : TDateTime;
begin
  WriteLn(ShortDateFormat);
  D := StrToDateTime('1/1/2000');
  WriteLn(DateTimeToStr(D));
  WriteLn(DateTimeToStr(Now));
end.
---

returns:

d/m/y
30-12-1899
15-11-2000 13:02

I'm using 1.0.2 compiler, RedHat 7.0,
what I know, this bug is in fpc 1.1 rtl too.

------------------------------------
Pavel Stingl
mailto:
------------------------------------

Reply by email

Michail A.Baikov
to Pavel Stingl

Sorry for bad english...

It's not bug, and your trouble.

In system set dateseparator as '.' (without quote) and you send to parser date with '/' separator. Compiler parse with dateseparator ('.') and space ' ' and not detect your customize separator.

May be you should:

1. Replace all customize separators (Ex. '/') on current system specific ('.' for me).
2. Use fpc function for set system dateseparator to your separator
3. Get dateseparator and replace your separator on dateseparator.

Choose :-)

2Devel: I think, we should make workaround ... :-/

Earlier message 40 lines
----- Original Message ----- From: "Pavel Stingl" To: "FPC mail" Sent: Wednesday, November 15, 2000 3:26 PM Subject: [fpc-devel]StrToDateTime bug > Hi, I have found possible bug in SysUtils unit - > function StrToDateTime returns null date -> > this piece of code > > --- > var > D : TDateTime; > > begin > WriteLn(ShortDateFormat); > D := StrToDateTime('1/1/2000'); > WriteLn(DateTimeToStr(D)); > WriteLn(DateTimeToStr(Now)); > end. > --- > > returns: > > d/m/y > 30-12-1899 > 15-11-2000 13:02 > > I'm using 1.0.2 compiler, RedHat 7.0, > what I know, this bug is in fpc 1.1 rtl too. > > ------------------------------------ > Pavel Stingl > mailto: > ------------------------------------ > > _______________________________________________ > fpc-devel maillist - > http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email