DateTimePicker control Format 
Author Message
 DateTimePicker control Format

 Can any one please tell me how to achieve the following:

I am using the DateTimePicker control to display the system time and
allow the user to change the time via this control (changes the program
system time and not the computer system time).

This all works apart from the fact that I want the time in 24hr format
with no AM or PM displayed.
I display the time on my status bar of my MDIform and have used the
correct format to display the time in 24hr (i.e. HH:mm:ss). But if the
user uses the datetimepicker control to change the status bar time
although it updates the time to what the user chooses it also changes
the display to non 24hr & with AM or PM accordingly.

This is happening because I have the datetimepicker using the constant
dtpTime in the properties window. This is the only way I can see to
get this control out of the datepicker calendar format and into the
time format with the up and down arrows. I have tried changing the
constant to dtpcustom and applying the 24hr format but it just went
into calendar mode.

Does anyone know how to use this control to display the time and allow
changes with the up/down arrows but have only displaying the time in
24hr format with no AM or PM at the end,
i.e. 14:22:41 and not 2:22:41 PM.

Thanks in advance,

Jonathan.

--
Nongy's Law Rule #1
Never chase women or buses - you will always get left behind.

Sent via Deja.com http://www.*-*-*.com/
Share what you know. Learn what you don't.



Mon, 28 Jan 2002 03:00:00 GMT  
 DateTimePicker control Format

Jonathan -

If you set the following properties, it should do what you're looking
for:

.Updown = True  (to get the up/down arrows instead of the calendar)
.Format = dtpCustom (to enable the next one)
.CustomFormat = "HH:mm:ss"  (Capital H's to display in 24-hour style)

...doug

Quote:

> Can any one please tell me how to achieve the following:

>I am using the DateTimePicker control to display the system time and
>allow the user to change the time via this control (changes the program
>system time and not the computer system time).

>This all works apart from the fact that I want the time in 24hr format
>with no AM or PM displayed.
>I display the time on my status bar of my MDIform and have used the
>correct format to display the time in 24hr (i.e. HH:mm:ss). But if the
>user uses the datetimepicker control to change the status bar time
>although it updates the time to what the user chooses it also changes
>the display to non 24hr & with AM or PM accordingly.

>This is happening because I have the datetimepicker using the constant
> dtpTime in the properties window. This is the only way I can see to
>get this control out of the datepicker calendar format and into the
>time format with the up and down arrows. I have tried changing the
>constant to dtpcustom and applying the 24hr format but it just went
>into calendar mode.

>Does anyone know how to use this control to display the time and allow
>changes with the up/down arrows but have only displaying the time in
>24hr format with no AM or PM at the end,
>i.e. 14:22:41 and not 2:22:41 PM.



Mon, 28 Jan 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. DateTimePicker control format

2. DateTimePicker control format

3. DateTimePicker and custom date format

4. formatting date on DateTimePicker

5. DateTimePicker and other controls from Windows Common Controls-2 6.0

6. Control Similar to Datetimepicker control

7. How to install DateTimePicker Control to another computer

8. Blank .text value for DateTimePicker control

9. How to simulate DateTimePicker control in ASP.NET?

10. customize month names in DateTimePicker Control

11. Binding a datetimepicker control to a date time dataset field does not work

12. How to bind data to DateTimePicker control?

 

 
Powered by phpBB® Forum Software