Hi
When i run this statement select now in MySql it displays 2011-09-06 10:33:36 which is O.K
But through C#
datetime _dt;
string ConnectionStr = ConfigurationManager.ConnectionStrings["cnn"].ConnectionString;
MySqlDataAdapter da = new MySqlDataAdapter("select now()", ConnectionStr);
DataTable dt = new DataTable();
da.Fill(dt);
_dt = (DateTime)dt.Rows[0][0];
it displays 06-09-2011 2:04:09 which is wrong . I want which is dispplaed in MYsql it should display that .
Thanks
Fetching Datetime type value from database
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Dan SullivanRank #3,426 · 422 reputationPosted Sep 5, 2011, 9:47 PM EDT
I think you are just seeing the default ToString() output of a DateTime object. Have a look manipulating what modifications you can do to it here http://msdn.microsoft.com/en-us/library/k494fzbf.aspx
~Dan
Jagjit Saini166 reputationPosted Sep 5, 2011, 11:32 PM EDT