Hi I want to convert System date into desired format before displaying it to the user.
For eg.
The system date might be in mm/dd/yy format and I want to display it in dd/mm/yy format and vice-versa.
Please help me in figuring this out.

To get the current time in formats you want, just use the following:

DateTime timeRightNow = DateTime.Now;
string format1 = timeRightNow.ToString("dd/MM/yy");
string format2 = timeRightNow.ToString("MM/dd/yy");

Console.WriteLine(format1);
Console.WriteLine(format2);

The output will be this:

01/11/10
11/11/10

Note: this is based on your local date being 1st November, 2010.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.