Click here to Skip to main content
15,921,028 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i'm writing code in vb.net(window app)
how to change system date format using CultureInfo

Ex. my system default date is in the format "MM/dd/yyyy"
and i want to change this format to "dd/MM/yyyy" at runtime
Posted

Hey I have posted a c# solution
Follow link

Change System Date Format At Runtime[^]
 
Share this answer
 
When you are writing things out, you can actually use format converters to control what is displayed. It's normally a bad idea though to force a date to appear in a format other than the one the user is expecting - this often leads to confusion. Suppose I put 11/05/2010 in as a date, is this the 11th of May or the 5th of November? Suppose that my appointment is for the 11th of May, but I miss it because I've read the date wrong. Simple things like that can really ruin the user experience and are best avoided.

If you must force the change though, you can use the format specifier {0:dd/MM/yyyy}, e.g.
string date = string.Format("{0:dd/MM/yyyy", DateTime.Now);
 
Share this answer
 
Hi,

You may use something like:
string aa =18-Sep-2008 04:30:01 PM
string dt = Convert.ToDateTime(aa).ToString("dd/MM/yyyy")
 
Share this answer
 
v3

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