How to format below Date in yyyy-MM-dd format with the help of String.Format method?

DateTime dt_todays_date = DateTime.Now;

 Posted by Rajesh_Kumar on 1/21/2014 | Category: C# Interview questions | Views: 2681 | Points: 40
Answer:

We will use below code to format Date as

string str = string.Format("{0:yyyy-MM-dd}", dt_todays_date);

Response.Write(str);


Output:2013-01-21


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response