Welcome to Dream.In.Code
Getting VB.NET Help is Easy!

Join 131,687 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 2,505 people online right now. Registration is fast and FREE... Join Now!




How to change the format of DateTimePicker1

 
Reply to this topicStart new topic

How to change the format of DateTimePicker1

Mangore
post 14 Oct, 2008 - 07:31 PM
Post #1


D.I.C Head

**
Joined: 11 Oct, 2008
Posts: 70

The format of DateTimePicker1 it's show like this :Month / Day / Year. I want to make it like this : Day / Month / Year when I use this code to print the history to textbox:
CODE
TextBox1.Text = DateTimePicker1.Text


Is this possible?

This post has been edited by Mangore: 14 Oct, 2008 - 07:42 PM
User is offlineProfile CardPM

Go to the top of the page


n8wxs
post 14 Oct, 2008 - 07:56 PM
Post #2


D.I.C Regular

***
Joined: 6 Jan, 2008
Posts: 299



Thanked 26 times
My Contributions


Yes. See

http://msdn.microsoft.com/en-us/library/sy...stomformat.aspx
User is offlineProfile CardPM

Go to the top of the page

Mangore
post 14 Oct, 2008 - 08:14 PM
Post #3


D.I.C Head

**
Joined: 11 Oct, 2008
Posts: 70

QUOTE(n8wxs @ 14 Oct, 2008 - 08:56 PM) *


I tried like this but not success

CODE
DateTimePicker1.Format = " dd,mm,yyyy"
TextBox1.Text = DateTimePicker1.Text
User is offlineProfile CardPM

Go to the top of the page

Mangore
post 15 Oct, 2008 - 04:53 AM
Post #4


D.I.C Head

**
Joined: 11 Oct, 2008
Posts: 70

Here is the way thank you for help.

To change Format:
DateTimePicker1.Format = DateTimePickerFormat.Custom
DateTimePicker1.CustomFormat = " dd /MM/ yyyy "
User is offlineProfile CardPM

Go to the top of the page

dbasnett
post 15 Oct, 2008 - 11:37 AM
Post #5


D.I.C Head

**
Joined: 1 Oct, 2008
Posts: 131



Thanked 5 times
My Contributions


CODE
         TextBox1.Text = DateTimePicker1.Value.ToString("MM,dd,yy") 'this
        TextBox1.Text = DateTimePicker1.Value.ToString("MM/dd/yy") 'or traditional
        TextBox1.Text = DateTimePicker1.Value.ToString("MM/dd/yy  hh:mm:ss") 'or traditional with time
User is online!Profile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/20/08 08:00AM

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month