Regional Settings

rickster57

New member
Joined
Sep 7, 2007
Messages
2
Programming Experience
Beginner
Does any one know how to change the Date Format in Regional Settings via vb.net?
I'm trying to change it to yyyy-MM-dd using the following code that I found on the internet but it changes nothing.
Thanks in advance

Dim ci As New System.Globalization.CultureInfo("en-US", True)
System.Threading.Thread.CurrentThread.CurrentUICulture = New System.Globalization.CultureInfo("en-US")

Dim newCi As System.Globalization.CultureInfo = CType(ci.Clone(), System.Globalization.CultureInfo)

newCi.DateTimeFormat.ShortDatePattern = "yyyy-MM-dd"
System.Threading.Thread.CurrentThread.CurrentCulture = newCi
 
You should not change someones OS regional settings, instead accomodate your application to handle/output data formatting when running in different cultures.
 
Thanks John for the quick reply and advice. I am new to vb.net and have found that if I don't set the regional setting to yyyy-MM-dd not all records are returned in my sql statement searching for records in a date range..

Never had the issue in Microsoft Access.

Something I'm missing?

Thanks for the help and advice.
 
I'm sure you can specify query parameters as Date (which is culture independent) or format a date string the string column that should represent a date string would comply to. Ask in data access forums. Changing the computers culture is not the way to go.
 
Back
Top