title: convert back datetime format toLongdatestring to (M/DD/YYYY h/mm/ss)
body: <p>hi i have datetime format in database like this</p>
  
  <pre><code>1/18/2014 4:14:52 PM (M/DD/YYYY h/mm/ss)
  </code></pre>
  
  <p>i convert it to <em>ToLongDateString</em></p>
  
  <pre><code>string date = Convert.ToDateTime(myQuizOccurrence.occurred).ToLongDateString();
  **result -&gt;** **Sunday, January 12, 2014**
  </code></pre>
  
  <p>i want to convert back again that result date to become same format as database i wonder how to do it?</p>
  
  <hr>
  
  <h2><em><strong>edited</em></strong></h2>
  
  <p>so far i already try as @matt says using datetime instead string  </p>
  
  <pre><code>DateTime dt2 = (DateTime) myDataGridView.CurrentRow.Cells[3].Value;
  </code></pre>
  
  <p>i already check it's have same format as datetime in database<br>
  but when i try to matching in query with this following code</p>
  
  <pre><code>  Global.dbCon.Open();
    string kalimatsql2 = "SELECT * FROM Quiz_Occurrences WHERE Occurred = " +dt2+ " 
                              ORDER BY ID";
    Global.reader = Global.riyeder(kalimatsql2);
    if (Global.reader.HasRows) {
       while (Global.reader.Read()) {
          int idku = Convert.ToInt32(Global.reader.GetValue(0));
          MessageBox.Show(idku.ToString());
       }
    }
    Global.dbCon.Close();&lt;br&gt;
  </code></pre>
  
  <p>it's give error result<br>
  <strong>Syntax error (missing operator) in query expression 'Occurred = 1/12/2014 4:18:59 PM'</strong><br>
  what i'm missing?</p>