如何将日期转换为小时

I am having :

hours1 : 403440

and date2 as :2016/01/10

I need to convert date2 in hours and find the difference between the two which should again be in hours.

The second parameter of date is a unix timestamp which is in seconds so multiple your hours by 3600 (3600 seconds per hour).

$hours1 = 403440 * 3600;
$date1 = date("d-m-Y H:i:s", $hours1);
echo $date1;

Output:

09-01-2016 19:00:00

Per your update your code should be:

$date2 = strtotime('2016/01/10');//get date to seconds from 1970
$hours1 = 403440 * 3600; // convert from hours to seconds
echo ($date2 - $hours1)/3600;//subtract seconds then divide by 3600 to get how many hours difference is

Output:

5

The second parameter of date() is unix timestamp which is the number of seconds since January 1 1970 00:00:00 UTC. So, if $hours1 is number of hours since January 1 1970 00:00:00 UTC, it should be date("d-m-Y H:i:s",$hours1*3600); to yield the correct date string.

On the other hand, $hours2=(strtotime($date2)/3600); is giving you the correct number of hours since January 1 1970 00:00:00 UTC.