Reply to subtract 1 day

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация