title: Unix timestamp to .net DateTime
body: <p>I must be doing an obvious mistake but I can't figure it out.</p>
  
  <p>I am importing a date stored in a mysql database (it is stored by the ExpressionEngine CMS). It is a unix timestamp, i.e. seconds since 1/1/1970 00:00.</p>
  
  <p>So I'm doing something like this:</p>
  
  <pre><code>DateTime dateTime = new System.DateTime(1970, 1, 1, 0, 0, 0, 0);
  dateTime = dateTime.AddSeconds(orderdate /* int read from the database */);
  </code></pre>
  
  <p>Unfortunately I don't get the right result. Here is an example:</p>
  
  <p>Value read from the DB: <strong>1258598728</strong> (this is an order date)</p>
  
  <p>Paypal sent an email establishing the order at <strong>Nov 18, 2009 12:45:20 PST</strong></p>
  
  <p>The php web site that reads this value in the DB and knows how to display this date correctly displays it as <strong>2009-11-18 03:45 PM</strong> (which seems correct since I’m hosted at a server on the east coast)</p>
  
  <p>My code above gives <strong>11/19/2009 2:45:28 AM</strong> !! (UTC which gives 11/18/2009 9:45 PM east time, i.e. 6 hours difference with what is expected)</p>
  
  <p>I get the same result if using DateTimeOffset taking care of putting the right timezone.</p>
  
  <p>Any idea what I'm doing wrong?</p>