Jagjit Saini

Jagjit Saini

  • NA
  • 166
  • 0

How to store and fetch Date and time into a database in a particular format

Sep 5 2011 8:39 AM
Hi

  datetime abc


  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];
  abc = _dt;

  It display value as 05/09/11 06:09:00 PM , but i don't want to store PM

Thanks

Answers (3)