NEed to Change System Date Format Programmatically Using VB.NET

Hi,
I need to change the System Date Format programmatically to specific format. I should be able to get the current Date format then I should be able to change the System Date Format to dd-MMM-yy. Please help. Only vb.NET Code would be accepted.
payasiashishAsked:
Who is Participating?
 
Bob LearnedConnect With a Mentor Commented:
I mean it doesn't stick after you close your program--not a permanent change.  I am thinking that this isn't a bad thing, just change it to what you want it to be within your program, and let the user keep what they already have.
0
 
adomsgCommented:
txtDate.text =  Format(Date.Now,"dd-MMM-yy")
0
 
payasiashishAuthor Commented:
NO this is not what I Want.
I want to Access Regional Settings - Date and the specofy a Format to it, I do not want to format the date I want to get the Current Format of Date In the System and the Change the same (Date Format of the system) Programatically in VB.NET
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
Bob LearnedCommented:
System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern
0
 
payasiashishAuthor Commented:
With this I can retrive the date format however I am not able to set the date. It says its readonly property. Can you help me.
0
 
Bob LearnedCommented:
You can temporarily override this value:

Imports System.Globalization
Imports System.Threading.Thread
...

      Dim newCulture As CultureInfo = New CultureInfo(CultureInfo.CurrentCulture.Name)
      newCulture.DateTimeFormat.ShortDatePattern = "dd-MMM-yy"
      CurrentThread.CurrentCulture = newCulture
      MsgBox(CurrentThread.CurrentCulture.DateTimeFormat.ShortDatePattern.ToString)
0
 
payasiashishAuthor Commented:
Thanks for the hellp but I am confused with Temporarily override thing. Can you elobrate this. Does this mean this will reset to what it was earlier after the program terminates?
0
All Courses

From novice to tech pro — start learning today.