Jagjit Saini

Jagjit Saini

  • NA
  • 166
  • 0

Fetching Datetime type value from database

Sep 6 2011 1:12 AM
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)