Problem in date time picker

selvakumar_82

Member
Joined
Nov 29, 2005
Messages
6
Programming Experience
Beginner
Hi friends,

My problem is,
I want to change my datetime format in the datetimepicker , without changing datetime picker properties.

i have to change local machine datetime format................?

or anyother possiblities or there.....................?

i.e my vb.net format : 20-mar-06
but it should be : 3/20/2006

It is possible to change localmachine datetime format........

Regards,

Selva.R
 
Two examples, you can use both a CultureInfo and a DateTimeFormatInfo based on a predefined culture to format the date string, the DateTimeFormatInfo can also be used to customize a dateformat.
VB.NET:
Dim dt As Date = Date.Now
Dim glob As New Globalization.CultureInfo("en-US", False)
Dim DTFI As Globalization.DateTimeFormatInfo = glob.DateTimeFormat
MsgBox(dt.ToString("d", glob))
MsgBox(dt.ToString("d", DTFI))
If you want to change the culture of your application altogether, then here is an example:
VB.NET:
Threading.Thread.CurrentThread.CurrentCulture = New [SIZE=2]Globalization[/SIZE].CultureInfo("en-US")
MsgBox(dt.[SIZE=2]ToShortDateString[/SIZE])
MSDN "Formatting Date and Time for a Specific Culture"
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconformattingobjectsforspecificculture.asp


Moved thread to Localization/Internationalization forum.
 
Back
Top