DateTimePicker - Format Value

T

Terry

My system short date format is dd/mm/yy.

The DateTimePicker returns mm/dd/yyyy hh:mm:ss PM.

I need to get this value formated into dd/mm/yyyy regardless of the system
short date format, what do I need to use please.

Regards
Terry
 
H

Herfried K. Wagner [MVP]

Terry said:
My system short date format is dd/mm/yy.

The DateTimePicker returns mm/dd/yyyy hh:mm:ss PM.

I need to get this value formated into dd/mm/yyyy regardless of the system
short date format, what do I need to use please.


The DateTimePicker control's 'Value' property returns a 'Date' instance,
which you can format by calling its 'ToString' method and passing
appropriate formatting options to this method.
 
D

diego

Hi Terry,

Try setting the Format property = Custom and CustomFormat property =
"dd/MM/yyyy"

hth

diego
 
T

Terry

Thanks Diego,

This will be useful for changing the displayed value in the control, at the
moment long date is OK. Thanks for the usefull info.
Regards

Terry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top