I'm having trouble with some date functionality which I'm hoping someone will be able to help me with.

The scenario is that I'm being given data which has a creation date. The problem is that the creation date is calculated by the number of hours passed from a pre-defined date, in this case 1900-01-01.

I've tried a couple of methods to work this out, my first looks like this:

$datefrom = 957047;
$this->strDate = (date('Y-m-d H:00:00', strtotime('+'.$datefrom.' hours', date_format(date_create('1900-01-01'), 'U')))."\n");

This ends up printing out '2011-02-16 19:00:00'
The date I should be getting should be something in the region of '2009-01-02'
This method is basically trying to use strtotime to increase the given date by the given number of hours.

My second method looks like this:

$datefrom = 957047;
$secondsSince1900 = date_format(date_create('1900-01-01'), 'U');
$datefromInSeconds = $datefrom*60*60;

$SecondsAdded = $secondsSince1900+$datefromInSeconds;

$newDate = date_create($SecondsAdded);

echo("dateformat: ".date('Y-m-d H:00:00', $SecondsAdded)."\n");

This one's getting a bit closer with a result of '2009-03-06 23:00:00'
I've converted the hours passed into seconds and added that to the timestamp, then I've converted it into a date format.

I did notice that if I change the '$datefrom' to 0, then the result is actually '1901-12-13 20:00:00' instead of '1900-01-01' which it should still be as it's just changing the date from a timestamp and back to a date format.

Any help would be fantastic.

Thanks in advance.