I commonly use the following code when I want to control the format of the
datetimepicker control
   uses commctrl
   DFormat : String;
   DFormat := 'dd/MMM/yyyy';
   for i := 0 to ComponentCount - 1 do
    if ( Components[i] is TDateTimePicker ) then
      (Components[i] as TDateTimePicker).Perform ( DTM_SETFORMAT ,
DWORD(NIL) , DWORD(DFormat) );

I place this code in the formshow event as it does not work in formcreate


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
Behalf Of Nello Sestini
Sent: Thursday, October 05, 2000 5:08 PM
To: Multiple recipients of list delphi
Subject: Re: [DUG]: EConvert error on date time picker


I've had trouble doing this when using the DatePicker
control and the Control Panel date settings conflict
with the way I wanted to set ShortDateFormat.

The particular situation was on a system that
had to set control panel to USA m/d/yy format (because
of some software they were using that required it) but
wanted my app to continue to display the local
d/m/yyyy format the users were accustomed to.

This works fine for TDateTime, TDateField etc - but the
TDateTimePicker is a wrapper for the WIN32 control and
it continues to pick up the Control Panel settings.

So you get weird behaviour like a format switch to
m/d/y dates while  editing and sometimes EConvert
exceptions.

rgds

ns


-----Original Message-----
From: Cory Shanks <[EMAIL PROTECTED]>
To: Multiple recipients of list delphi <[EMAIL PROTECTED]>
Date: Thursday, October 05, 2000 09:24
Subject: RE: [DUG]: EConvert error on date time picker


A way to override the regional settings' date format completely is to add
SysUtils to uses
and then set ShortDateFormat.

e.g.
  ShortDateFormat := 'dd/mm/yyyy';

Cheers,

Cory Shanks.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
Behalf Of Tony Sinclair
Sent: Tuesday, 3 October 2000 16:44
To: Multiple recipients of list delphi
Subject: RE: [DUG]: EConvert error on date time picker


Have you tried altering the regional settings of the Date/Time format on the
machine?  I remember we had some trouble with a D1 app ages ago with a
DTPicker and we had to alter the win.ini file.  I think it's under [itnl]
and there is a shortdate and longdate format.

Tony Sinclair
Holliday Group Limited
Christchurch
New Zealand


-----Original Message-----
From: Leo Ramakers [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 4 October 2000 16:29
To: Multiple recipients of list delphi
Subject: Re: [DUG]: EConvert error on date time picker


Bevan

> Why not use 30/12/99?  Or 30-Dec-99?

The DateTimePicker converts it into its own format. I need to figure out how
the system uses the global variables Short and LongDateTimeFormat, they seem
to affect the
variuos date routines.

thanks for considering it anyway.

Leo

>
>
> Regards,
>
> Bevan
>
> Leo Ramakers wrote:
> >
> > hi
> > I have a maddening problem that shows up sporadically during a form
startup where the form contains a datetime picker. The date is set to, say
30/Dec/99, and the
> > startup complains "EConvertError - 30/Dec/99 is not a valid date" and
the program bombs.
> >
> > Any clues as to how to stop this
> >
> > many thanks
> > Leo
> >

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"

Reply via email to