This is the current date format of the System
This
following C# code is used to change date format
The namespace of RegistryKey is using
Microsoft.Win32;
private void
button1_Click(object sender, EventArgs e)
{
string DateFormat =
txtDateFormat.Text.Trim();
string TimeFormat =
txtTimeFormat.Text.Trim();
RegistryKey rkey = Registry.CurrentUser.OpenSubKey(@"ControlPanel\International", true);
///Set Values
rkey.SetValue("sTimeFormat", TimeFormat);
rkey.SetValue("sShortDate", DateFormat);
//Close the Registry
rkey.Close();
}
The new date
format is displayed below
Nice Article Fahad..
ReplyDeleteSmall mistake in this line..
RegistryKey rkey = Registry.CurrentUser.OpenSubKey(@"ControlPanel\International", true);
Replace ControlPanel instead of Control Panel
after change it will work fine...