TDATETIMEPICKER

Can tdatetimepicker component shows date in this format (dd/mm/yyyy) or (mm/dd/yyyy)????????????????????
IammeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

IammeAuthor Commented:
I need the answer........as fast you can
0
VendiCommented:
Look at the TDateTimeField.DisplayFormat property
0
VendiCommented:
Sorry, just reread your question.  I think the tdatetimepicker format comes from the regional settings of the computer, but I'm not sure.
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

IammeAuthor Commented:
no I think tnat we can´t change the format .................i had tryed.....
0
intheCommented:
please try these different ways of setting the format:
 
(note upper/lowercase matters)

//Uses Commctrl;
procedure TForm1.FormCreate(Sender: TObject);
begin
SendMessage(DateTimePicker1.Handle,DTM_SETFORMAT, 0,LongInt(PChar('HH:mm:ss')));

//The format strings are what Windows allows in the Regional
// Settings for Time -  "HH" is military (24h time) and
//"hh" is 12 hour, adding "tt" to the end gets you the "am" / "pm", etc.

end;

//or with date and am/pm also:
procedure TForm1.Button1Click(Sender: TObject);
begin
SendMessage(DateTimePicker1.Handle,DTM_SETFORMAT, 0,LongInt(PChar('dd/MM/yyyy HH:mm:ss tt')));
end;

// or
procedure TForm1.Button2Click(Sender: TObject);
begin
Application.UpdateFormatSettings := False;
ShortTimeFormat := 'HH:mm:ss';
end;
0
IammeAuthor Commented:
delphi doesn´t accept    DTM_SETFORMAT...............it says that it is undeclared............please help me...........
0
intheCommented:
add to Uses Commctrl;


did you try last method ?
0
IammeAuthor Commented:
yes the unit is alredy using.......and i tryed the last method......
can you tell me step by step????
I really need it..
0
lsaeCommented:
you could try setting the shortdateformat global variable (in case the dateformat = dfShort otherwise change the longdateformat variable) to 'dd/mm/yyyy' or
'mm/dd/yyyy' to accomplish this.

greetings;

Ludo
0
intheCommented:
did you try the last method i post:

procedure TForm1.Button2Click(Sender: TObject);
begin
Application.UpdateFormatSettings := False;
ShortDateFormat := 'dd/MM/yyyy';
end;


or for the DTM_SETFORMAT you will have to use start-find and  search your harddrive for a *.pas   file that contains DTM_SETFORMAT then you will see what pas file to add to your uses..

for me it is declared in commctrl but maybe you can just add the const straight to your project :

procedure TForm1.Button1Click(Sender: TObject);
const
  {$EXTERNALSYM DATETIMEPICK_CLASS}
  DATETIMEPICK_CLASS = 'SysDateTimePick32';

  // Message constants
  {$EXTERNALSYM DTM_FIRST}
  DTM_FIRST         = $1000;
  {$EXTERNALSYM DTM_GETSYSTEMTIME}
  DTM_GETSYSTEMTIME = DTM_FIRST + 1;
  {$EXTERNALSYM DTM_SETSYSTEMTIME}
  DTM_SETSYSTEMTIME = DTM_FIRST + 2;
  {$EXTERNALSYM DTM_GETRANGE}
  DTM_GETRANGE      = DTM_FIRST + 3;
  {$EXTERNALSYM DTM_SETRANGE}
  DTM_SETRANGE      = DTM_FIRST + 4;
  {$EXTERNALSYM DTM_SETFORMATA}
  DTM_SETFORMATA    = DTM_FIRST + 5;
  {$EXTERNALSYM DTM_SETMCCOLOR}
  DTM_SETMCCOLOR    = DTM_FIRST + 6;
  {$EXTERNALSYM DTM_GETMCCOLOR}
  DTM_GETMCCOLOR    = DTM_FIRST + 7;
  {$EXTERNALSYM DTM_GETMONTHCAL}
  DTM_GETMONTHCAL   = DTM_FIRST + 8;
  {$EXTERNALSYM DTM_SETMCFONT}
  DTM_SETMCFONT     = DTM_FIRST + 9;
  {$EXTERNALSYM DTM_GETMCFONT}
  DTM_GETMCFONT     = DTM_FIRST + 10;
  {$EXTERNALSYM DTM_SETFORMATW}
  DTM_SETFORMATW    = DTM_FIRST + 50;
  {$EXTERNALSYM DTM_SETFORMAT}
  DTM_SETFORMAT     = DTM_SETFORMATA;
begin
SendMessage(DateTimePicker1.Handle,DTM_SETFORMAT, 0,LongInt(PChar('dd/MM/yyyy HH:mm:ss tt')));
end;

0
she3i3iCommented:
Iamme,

Simply do the following:

Start
Settings
Control Panel
Regional Settings

Move to the Date tab.

Change "Short Date Style" to either:
dd/MM/yyyy
or
MM/dd/yyyy

as you like.

If someone can do this programmatically, Id like to know how!


Chris.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
she3i3iCommented:
P.S. Once you actually do that, remove and replace the TDateTimePicker component on the form in order for it to read the changes made to the system settings.

Cheers, Chris.
0
intheCommented:
procedure TForm1.Button2Click(Sender: TObject);
begin
Application.UpdateFormatSettings := False;
ShortDateFormat := 'dd/MM/yyyy';
end;
0
IammeAuthor Commented:
hi.........she3i3i........are you women?....thank you...if a can do it programming,,,,I'll tell you.....but...your answer was ok....
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.