Alex Rivera | Logout

How to convert date format to DD-MM-YYYY in C#

Asked 2011-01-10T17:36:09.237
27

How to convert date format to DD-MM-YYYY in C#? I am only looking for DD-MM-YYYY format not anything else.

Edit
Report

2 Answers

14

According to one of the first Google search hits: http://www.csharp-examples.net/string-format-datetime/

// Where 'dt' is the DateTime object...
String.Format("{0:dd-MM-yyyy}", dt);
answered 2011-01-10T17:39:32.980
8
string formattedDate = yourDate.ToString("dd-MM-yyyy");
answered 2011-01-10T17:38:09.317

Your Answer