I have to make an obvious mistake, but I can't figure it out.
I am importing the date stored in mysql database (it is stored in ExpressionEngine CMS). This is the unix timestamp, i.e. seconds from 01/01/1970 00:00.
So, I am doing something like this:
DateTime dateTime = new System.DateTime(1970, 1, 1, 0, 0, 0, 0);
dateTime = dateTime.AddSeconds(orderdate );
Unfortunately, I am not getting the correct result. Here is an example:
The value read from the database: 1258598728 (this is the date of order)
Paypal sent an email with the order on November 18, 2009 12:45:20 PST
The php website that reads this value in the database and knows how to display this date correctly displays it as 2009-11-18 03:45 PM (which seems correct, since Im hosted on a server on the east coast)
My code above gives 11/19/2009 2:45:28 AM !! (UTC, which gives 11/18/2009 9:45 p.m. EST, i.e. 6 hours difference from what is expected)
I get the same result if you use DateTimeOffset to take care of the correct time zone.
Any idea what I'm doing wrong?