Board index » cppbuilder » Date format in TDateTimePicker

Date format in TDateTimePicker


2006-06-08 10:14:27 PM
cppbuilder63
Hi,
I am using the TDateTimePicker component. The dateformat is set
to dfshort.
When my PC is set as English (United Kingdom) the date displays
(when the picker is closed up) correctly as 17/8/06.
When my PC is set to English (US) the date appears as 17/ 8/06.
I cannot get rid of the space.
If I try and use the Format property, eg dd/mm/yy then the same
date dispays as 01/00/06.
Can anyone please help?
Thanks.
 
 

Re:Date format in TDateTimePicker

Can't you use FormatDateTime?
TDateTime thetime = DateTimePicker1->DateTime;
Memo1->Lines->Add(FormatDateTime("MM/DD/YYYY",thetime));
Memo1->Lines->Add(FormatDateTime("DD/MM/YYYY",thetime));
JB wrote:
Quote
Hi,
I am using the TDateTimePicker component. The dateformat is set
to dfshort.
When my PC is set as English (United Kingdom) the date displays
(when the picker is closed up) correctly as 17/8/06.
When my PC is set to English (US) the date appears as 17/ 8/06.
I cannot get rid of the space.
If I try and use the Format property, eg dd/mm/yy then the same
date dispays as 01/00/06.
Can anyone please help?
Thanks.
 

Re:Date format in TDateTimePicker

Dan Mayo < XXXX@XXXXX.COM >wrote:
Quote

Can't you use FormatDateTime?

TDateTime thetime = DateTimePicker1->DateTime;
Memo1->Lines->Add(FormatDateTime("MM/DD/YYYY",thetime));
Memo1->Lines->Add(FormatDateTime("DD/MM/YYYY",thetime));

Thanks, this is effectively what I was trying to do, but I
used mm (minutes) instead of MM (months) and not suprisingly
got a strange result!
 

{smallsort}