[DUG] TFormatSettings
Kyley Harris
Kyley at harrissoftware.com
Wed Nov 10 23:26:26 NZDT 2010
I never store dates in a locale format.. Editing them on the GUI is
fine.. but the moment the value is pulled from the edit control its
either TDateTime, or a Fixed internal string format 'yyyy-mm-dd' when
needing to pass a value through streams etc. I've found it bad policy
to confuse View with Data in the past. In this way.. it really doesn't
matter what the locale is. except for making it paint properly on the
screen, or reporting.
What was the problem? ;)
On Wed, Nov 10, 2010 at 11:21 PM, Ross Levis <ross at stationplaylist.com> wrote:
> Sorry, found the problem.
>
>
>
> From: delphi-bounces at delphi.org.nz [mailto:delphi-bounces at delphi.org.nz] On
> Behalf Of Ross Levis
> Sent: Wednesday, 10 November 2010 10:56 PM
> To: 'NZ Borland Developers Group - Delphi List'
> Subject: [DUG] TFormatSettings
>
>
>
> This is really bizarre.
>
>
>
> I store a snapshot of all the regional settings when the program is started,
> to prevent issues if the date format is changed while the program is
> running. I store a couple of dates in a string using DateToStr and use
> StrToDate to convert it back later.
>
>
>
> var FS: TFormatSettings;
>
> GetLocaleFormatSettings(LOCALE_SYSTEM_DEFAULT, FS);
>
>
>
> My default DateDelimiter is “/”, and FS.DateDelimiter shows as being “/”.
>
>
>
> If I then change the date delimiter in the Windows Regional Settings to “-“,
> and then test FS.DateDelimiter, it has changed to a “-“ !!!!
>
>
>
> How is this possible?
>
>
>
> _______________________________________________
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi at delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject:
> unsubscribe
>
--
Kyley Harris
Harris Software
+64-21-671-821
More information about the Delphi
mailing list