开发者

What time corresponds to : time()-24*60*60 ? (PHP)

W开发者_JAVA百科hat time corresponds to

time()-24*60*60 

7 days? is that right?


time 24 hours ago.

time() returns the current Unix timestamp which is number of seconds since the Unix Epoch. Also there are 24 hours in a day and 60 min in an hour and 60 sec in a min.


time() works with seconds, so:

60 * 60 = 3600 seconds (1 hour)
24 * 1 hour = 1 day
24 * 60 * 60 = 1 day


One day ago actually. You're missing a 7 * if you need 7 days...


year=365.3days day=24hours, hour=60minutes, minute=60seconds, and there's all those second=1000milliseconds etc.

if you have 5 days and you need hours then you do 5days*24hours=5*24=120hours

if you have 123hours and need days you do, 123h/1day=123/24=5.125days

so you can go 3years=3*365days=1095day=1095*24hours=26280=etc or for faster calculation you can just do 3years=3years*365days*24hours*60minutes*60seconds*1000milliseconds=big number of milliseconds

and you can do same otherway around 5000milliseconds=5000ms/1000ms/60s/60min/24hours/365days=very small number of years

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜