Subject Re: [IBO] TIB_Date
Author Frank Ingermann
Hi there,

Geoff Worboys wrote:
> > My regional settings on my desktop is dd/mmm/yyyy. Dropped a
> > TIB_Date control on my form. Value displays correctly as
> > '01-Mar-2000'. Changed the date using the drop-down calendar.
> > New date can be saved. However, if I change the date manually
> > to '02-Mar-2000', IBO complains with '02-Mar-2000' is not a
> > valid date and time.'.
> >
> > No edit mask nor display format is set for that field.
> > What am I doing wrong?
> IBO uses the VCL supplied StrToDate and StrToDateTime functions.
> These are not as smart of Interbase date processing. <snip>

What should be noticed here is that the local settings in your
Delphi app are really variables. They are initialized by the
GetFormatSettings proc in sysutils, which is called there in the
initialization section. (it gets your desktop settings from windows).

Since sysutils will always be one of the first units to be initialized,
you can set any of these vars to whatever you like in the initalization
code of your app and they will persist during the runtime of your app.

So, in the original question setting ShortDateFormat to 'dd-mmm-yyy'
should do the job. I sometimes need to do some export stuff that
needs a different format setting, so i just remember the current
setting at the start of a try..finally block, set it to my needs, do
the export and then set it back to what it was before. Three lines
of code but i can still use StrToDate and StrToDateTime then.