473,516 Members | 3,399 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DateTimePicker - Format Value

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
Mar 28 '07 #1
5 7617
"Terry" <ne*******@whiteHYPHENlightDOTme.ukschrieb:
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.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Mar 28 '07 #2
Hi Terry,

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

hth

diego

On Mar 29, 5:32 am, "Terry" <news-g...@whiteHYPHENlightDOTme.uk>
wrote:
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
Mar 29 '07 #3
Thanks Herfield, perfect, just ready to drop right into a textbox.
Regards

Terry
"Herfried K. Wagner [MVP]" <hi***************@gmx.atwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
"Terry" <ne*******@whiteHYPHENlightDOTme.ukschrieb:
>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.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Mar 29 '07 #4
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

"diego" <di******@yahoo.comwrote in message
news:11**********************@o5g2000hsb.googlegro ups.com...
Hi Terry,

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

hth

diego

On Mar 29, 5:32 am, "Terry" <news-g...@whiteHYPHENlightDOTme.uk>
wrote:
>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

Mar 29 '07 #5
Sorry for the name typo, Herfried.
Regards

"Terry" <ne*******@whiteHYPHENlightDOTme.ukwrote in message
news:ut**************@TK2MSFTNGP02.phx.gbl...
Thanks Herfield, perfect, just ready to drop right into a textbox.
Regards

Terry
"Herfried K. Wagner [MVP]" <hi***************@gmx.atwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>"Terry" <ne*******@whiteHYPHENlightDOTme.ukschrieb:
>>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.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>


Mar 29 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1385
by: E-Cube | last post by:
Hello All, I have a datetimepicker whose initial format is: DateTimePicker1.Format = DateTimePickerFormat.Custom DateTimePicker1.CustomFormat = " " DateTimePicker1.Checked = False which will change to DateTimePicker1.Format = DateTimePickerFormat.Short
9
3937
by: Guy | last post by:
I have extended the datetimepicker control to incorporate a ReadOnly property. I have used the new keyword to implement my own version of the value property, so that if readonly == true then it will not set the value of the control and will leave the checked status of the checkbox to false when a user selects a new date. this works fine...
9
5027
by: Ed Crowley | last post by:
I have a DateTimePicker control on my form that is displaying the date format in UK format (dd/mm/yy). However, in my code dtpStartDate.Value gives a date in US format, but dtpStartDate.Value.ToString() gives the date in the required UK format! Any ideas? All system locale settings are set to British/UK settings.
2
19773
by: andreas | last post by:
Hi, I have a datetimepicker , format set to time and two strings, the first give me a hour lke "5" and the other the minutes like "15" How can i put these two values in the datetimepicker ? Thanks for any response
3
6351
by: Charlie | last post by:
In the top portion of the DateTimePicker, where the value of the date is displayed, how can I detect whether the month or day or year is currently focused, or, if ShowCheckBox = True, whether the checkbox is focused?
2
8170
by: Claes Wedin | last post by:
My customer needs a DateTimePicker in VS2005 C# that can show emty date values (blank/space/null). I need a control that: 1. Can show a blank value 2. Detete a date when hitting the delete and/or back key 3. Allowse the user to enter yyyy-MM-dd date format manually 4. When tabbed into the field behaves juast like a textbox
0
2580
by: tschroeder250 | last post by:
Hi Everyone, There are so many Nullable DateTimePickers out there that this post may not even be found among all the others, but I wanted to try. First, I want to thank all the authors of the code I used as a starting point. Second, I hope this code helps someone as much as they helped me. I have built a Nullable DateTimePicker and...
11
4987
by: jessy | last post by:
Hi, I have a problem with my DateTimePicker javascript code which i downloaded , the problem is when i pick the date and the date appears in my Text Field and i click Submit the date which i picked is not sent to the DB and instead the default value of the text field which is 00-00-0000 is Sent so what i need is to make the value i picked...
0
5636
by: priyamtheone | last post by:
I'm trying to make a datagridview column to act like a datetimepicker column (C#.Net 2005). These are the behaviours that the dgv should have: 1) Initially all the cells of the dtp column should be blank unless they are filled by the user. 2) As soon as the user enters a cell, the dtp control should appear as the editing control of that cell. If...
0
7182
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7405
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7574
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7136
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7547
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5712
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5106
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3252
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1620
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.