Posted by meltedown on 04/03/06 11:06
I can't see what I'm doing wrong. I'm subtracting 60*60*24 from a unix
time stamp and the result is 23 hours earlier, not 24.
Start with a unix time stamp:
$unixtime=1144018006;
convert it to a date:
$date=getdate($unixtime);
date Array
(
[seconds] => 46
[minutes] => 46
[hours] => 17
[mday] => 2
[wday] => 0
[mon] => 4
[year] => 2006
[yday] => 91
[weekday] => Sunday
[month] => April
[0] => 1144018006
)
date
subtract 1 day:
$gobackseconds=60*60*24 ;
$unixtime2=$unixtime-$gobackseconds;
and see what time it is:
$date2=getdate($unixtime2);
date2 Array
(
[seconds] => 46
[minutes] => 46
[hours] => 16
[mday] => 1
[wday] => 6
[mon] => 4
[year] => 2006
[yday] => 90
[weekday] => Saturday
[month] => April
[0] => 1143931606
)
date2
Notice that in the first date, there are 17 hours, and in the second
date there are 16 hours. Arrrrrrg. What is the problem ?
[Back to original message]
|