2
Answers

Fetching Datetime type value from database

Jagjit Saini

Jagjit Saini

12y
2.4k
1
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
Answers (2)