Hello friend, string.Format() is a function which can be used to represent a DateTime object in a specific Date format. Try the following code:
string currentDate = string.Format("{0:dd-MM-yyyy}", DateTime.Now);
Response.Write(currentDate);
Note: If you pass a string instead of a DateTime object, the format will not be applicable.
- DD