Hi Frnds,
any one knows how to convert date time from (27/10/2011) to (2010/10/27)
i need to insert in to database table(sql format (yyyy/mm/dd).
please any one knows well in this scenario help me
Thaks
Venkat.S
How to covert dat time in csharp .net
4 Answers
Know the answer? Post it. Somebody with the same question will find it here.


VulpesRank #55 · 29.2K reputationPosted Oct 27, 2011, 12:17 AM EDT
DateTime dt = new DateTime(2011, 10, 27);
string dateStr = dt.ToString("yyyy/MM/dd");
Hemant KumarRank #1,202 · 1.5K reputationPosted Oct 27, 2011, 1:13 AM EDT
Please refer this article for more information on Date Time
http://www.c-sharpcorner.com/UploadFile/vemuhemanth/9435/
Suthish NairRank #92 · 22.8K reputationPosted Oct 27, 2011, 10:33 AM EDT
Prabhu RajaRank #861 · 2.6K reputationPosted Oct 27, 2011, 8:20 PM EDT
Also try this one.
if ( DateTime.TryParse( dt.ToString("yyyy/mm/dd"), out dateString)
{
//dateString variable will have date in Specified Format.
}
else
{
//The Date is not Converted to Specified format.
}