No Problem.
uses Commctrl
var DFformat : String;
begin
//  DFormat := 'dd-MM-yyyy';  // BE CAREFULL: the "MM" should be capital
letters
  DFormat := 'MM-dd-yyyy';  // BE CAREFULL: the "MM" should be capital
letters
  DateTimePicker1.Perform ( DTM_SETFORMAT , DWORD(NIL) , DWORD(DFormat) );


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
Behalf Of Guy Brown
Sent: Thursday, September 07, 2000 11:12 AM
To: Multiple recipients of list delphi
Subject: [DUG]: Date formats


I am trying to add functionally that allows the user to chose their date
format from within our application.  In the application options screen the
user can choose one of dd/mm/yyyy, mm/dd/yyyy, dd/mm/yy, mm/dd/yy.  When our
application fires up I set the global ShortDateFormat variable and the date
format our database uses to the date format the user has chosen.

This all works quite well.  The problem that I am having is that some of the
3rd party components we use (including a date picker) use the Windows
regional setting date format internally.  When the user chooses a date with
the calendar part of the date picker (for example today's date 8/9/2000) it
can get put in the edit box as 9/8/2000.

I am able to set the regional setting date format with a call such as:

  SetLocaleInfo(GetUserDefaultLCID, LOCALE_SSHORTDATE, PChar('dd/MM/yyyy'));

Unfortunately this changes the date format for all applications.   I want to
limit it to only my application.  I have had a read through the Windows API
help and I can find a function (SetThreadLocale() ) that changes the locale
for a thread.  I  want to do something similar with the short date format
and set it for my thread only.

Does anyone know of a way to do this?

TIA

Guy Brown
TimeMaster System


---------------------------------------------------------------------------
    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"

---------------------------------------------------------------------------
    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