Click here to Skip to main content
15,894,180 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Hi How can I change the date format of system to yyyy/MM/dd by c#?
(in “Regional and Language” of conrol panel)
Thanks very much
Posted
Comments
Sergey Alexandrovich Kryukov 27-Apr-13 1:08am    
Will you share with us: why?
—SA

1 solution

First of all, you should think: why doing so?

Well, I can imagine that you could create yet another "System tweaks" utility which can modify many settings in a way a bit more convenient that the one already available in the OS. This is not a very productive activity, but I can imagine some users, after receiving proper warnings, will consider such utility legitimate.

In nearly all other cases, when you do it at the level of some application solving some applied problems, doing so would be a real crime against the user, the sabotage. Doing so is discouraged by Microsoft and, as far as I know, there is no API to do such thing (as well as many other system settings).

If you still think you have a reason to modify these system setting, you can do it by modifying some system registry records. For a current user, the key is:
C#
HKEY_CURRENT_USER\Control Panel\International

Drill down from this point, if you want.

See also: http://msdn.microsoft.com/en-us/library/microsoft.win32.registrykey%28v=vs.110%29.aspx[^].

You should understand how dangerous it can be. If you, say, provide an invalid time format, it can screw up the functionality of many applications and system utilities. Consider I warned you.

Now, maybe you want to rethink the idea and change the settings only for one application. You can just change the current culture and UI culture of some of your threads, in particular, the UI thread. Please see:
http://msdn.microsoft.com/en-us/library/system.threading.thread.currentculture.aspx[^],
http://msdn.microsoft.com/en-us/library/system.threading.thread.currentuiculture.aspx[^],
http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.aspx[^],
http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.clearcacheddata.aspx[^].

—SA
 
Share this answer
 
Comments
Karthik Harve 27-Apr-13 1:22am    
Nice 5+ :-) by the way SA, i remembered How to change system date format c#[^]
Sergey Alexandrovich Kryukov 27-Apr-13 1:36am    
Thank you, Karthik.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900