I am trying to get the correct DateSeparator
when the system locale is set to Cenz Republic. The current date is formatted as 9.3.2017
, but DateSeparator
is always '/'
instead of '.'
. What can I do to get the correct date separator?
Regarding date presentations there are several separate global variables affecting the output. You mention two of them:
`DateSeparator: Char;` (initialized from registry with reference `LOCALE_SDATE`)
`ShortDateFormat: string;` (initialized from registry with reference `LOCALE_SSHORTDATE`)
The other ones you can see in the documentation or in code in unit SysUtils
starting on line 490 (in Delphi 7, might be different in Delphi 5).
Since the DateSeparator
and ShortDateFormat
are separate variables, it is possible that you see dates presented correctly according your locale, while the DateSeparator
return an erroneous character.
To rectify, you can assign the correct character to DateSeparator
yourself in your code, but beware if you are using 3rd party libraries, that those might possibly also want to change it.