title: string to datetime conversion using System.Globalization.CultureInfo.InvariantCulture
body: <p>I have the following code to convert string into datetime..</p>
  
  <pre><code>string updateDateTime = "1398398552695";
  
  double temp = Double.Parse(updateDateTime);
  TimeSpan sp = TimeSpan.FromMilliseconds(temp);
  DateTime dt = new DateTime(1970, 1, 1).Add(sp);
  updateDateTime = dt.ToString("yyyy-MM-dd HH':'mm':'ss");//final date time
  
  string tt = dt.ToString("yyyy-MM-dd HH':'mm':'ss");
  DateTime output1;
  DateTime.TryParseExact(tt, "yyyy-MM-dd HH':'mm':'ss", System.Globalization.CultureInfo.InvariantCulture,System.Globalization.DateTimeStyles.None,out output1);
  
  DateTime output2 = DateTime.ParseExact(tt, "yyyy-MM-dd HH':'mm':'ss", System.Globalization.CultureInfo.InvariantCulture);
  
  Console.WriteLine(dt);
  Console.WriteLine(tt);
  Console.WriteLine(output1);
  Console.WriteLine(output2);
  </code></pre>
  
  <p>If we see the output it will be something like this..</p>
  
  <pre><code>25/04/2014 04:02:32//dt
  2014-04-25 04:02:32//tt
  25/04/2014 04:02:32//output1
  25/04/2014 04:02:32//output2
  </code></pre>
  
  <p>the problem is if we see output1 and output2 it is actually not giving result in yyyy-MM-dd format and I need value in this  format and in datetime type only coz in in database(MySQL) the field is in DateTime Format.
  So, i want the output in  2014-04-25 04:02:32 format but it is string and I need to convert it to datetime.</p>
  
  <p>Note : There are many questions related to this problem here in stackoverflow but my reputation is not enough to comment on them so I had to create this new question..</p>