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
Loading
Jagjit SainiPosted Sep 6, 2011, 3:32 AM
Dan SullivanPosted Sep 6, 2011, 1:47 AM
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