Sign in Join

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

Mailing lists / fpc-devel / 2004-08

DateSeparator

6 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

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

Tony Maro

The DateSeparator is defined in sysinth.inc as

Const
   { Character to be put between date, month and year }
   DateSeparator: char = '-';
   { Format used for short date notation }
   ShortDateFormat: string = 'd/m/y';
   { Format used for long date notation }
   LongDateFormat: string = 'dd" "mmmm" "yyyy';

Which means if I try to display something in the "standard" American format of mm/dd/yyy using:

FormatDate('mm/dd/yyyy',mydate)

I end up with "mm-dd-yyyy". The / gets replaced with the DateSeparator constant. Since it's an FPC constant, I can't easily change this.

Basically, this makes every date format function useless for me.

I see a note above it that says use InitInternational to set this, but that procedure seems to do nothing of the sort.

Can we not change all the defines in sysinth.inc to VAR instead of CONST so they could be manipulated by the programmer?

-Tony Maro

Reply by email

Marco van de Voort
to Tony Maro
Show quoted text 6 lines
The DateSeparator is defined in sysinth.inc as Const { Character to be put between date, month and year } DateSeparator: char = '-';

As said on IRC, I suspect this is a 1.0.10 issue. (1.9.x bootstrapping with 1.0.x I mean), since IIRC 1.0.x doesn't support

 var x : tx = vx;
syntax;
{ Format used for short date notation } ShortDateFormat: string = 'd/m/y';

Strange. That's not european at all? d-m-y or dd.mm.yy

Reply by email

Tony Maro
to Marco van de Voort
Marco van de Voort wrote 10 lines
>The DateSeparator is defined in sysinth.inc as > >Const > > { Character to be put between date, month and year } > DateSeparator: char = '-'; As said on IRC, I suspect this is a 1.0.10 issue. (1.9.x bootstrapping with 1.0.x I mean), since IIRC 1.0.x doesn't support

Right, but I'm suggesting it go ahead and be changed in 1.9.x... would this cause other problems?

Show quoted text 6 lines
> { Format used for short date notation } > ShortDateFormat: string = 'd/m/y'; Strange. That's not european at all? d-m-y or dd.mm.yy

True, but with the const dateseparator, it results in d-m-y of course ;-)

-Tony

Reply by email

Vincent Snijders
to Tony Maro
Show quoted text 24 lines
Marco van de Voort wrote: >>The DateSeparator is defined in sysinth.inc as >> >>Const >> >> { Character to be put between date, month and year } >> DateSeparator: char = '-'; > > > As said on IRC, I suspect this is a 1.0.10 issue. (1.9.x bootstrapping with 1.0.x I > mean), since IIRC 1.0.x doesn't support Right, but I'm suggesting it go ahead and be changed in 1.9.x... would this cause other problems? > >> { Format used for short date notation } >> ShortDateFormat: string = 'd/m/y'; > > > Strange. That's not european at all? d-m-y or dd.mm.yy True, but with the const dateseparator, it results in d-m-y of course ;-)
Even if it is a const, it is a typed constant and to those constants you can assign:
ShortDateFormat := 'm/d/y';

HTH,
Vincent.

Reply by email

Unknown author
to Tony Maro: The DateSeparator is defined in sysinth.inc as Const { Character to be put between date,…
Tony Maro wrote 6 lines
The DateSeparator is defined in sysinth.inc as Const { Character to be put between date, month and year } DateSeparator: char = '-';

As you can see it is a typed const, which means you can set it to any character you like. To solve your problems, set it to '/' at program startup, and you should be fine.

Same for the other constants.

I have thousands of lines of code, which frequently set it to various values. Never had a problem.

The reason it is a const is that initialized variables are not supported in 1.0.X, but typed constants (which are the same as initialized variables) are...

Michael.

Reply by email

Tony Maro
to Unknown author
Show quoted text 7 lines
As you can see it is a typed const, which means you can set it to any character you like. To solve your problems, set it to '/' at program startup, and you should be fine. Same for the other constants.

Ah... okay. So just a lack of knowledge on my part.

Thanks guys,
Tony

Reply by email