close

標題:

php mktime 問題

發問:

你好,想大家幫忙.我想寫個php programme,倒數距離每一日的10點,即是每日也看到距離明天10點還剩多少時間.那我先是定位了現在的時間: 我發覺我不懂怎樣倒數時,分,秒, 另外,上面的php也好像做不到我想要的 請問出了什麼問題? 求大家指教, 謝謝.

aa.jpg

 

此文章來自奇摩知識+如有不便請留言告知

最佳解答:

'; echo ((int)($timeRemain/(24*60*60))).'天 '.((int)($timeRemain/60/60)%24).'小時'.((int)($timeRemain/60)%60).'分'.($timeRemain%60).'秒'; ?> OR
$now){ $timeRemain=$toDay10am-$now; echo gmdate ("距離 G:i:s Y-n-d 還有" ,$toDay10am); }else{ $timeRemain=$nextDay10am-$now; echo gmdate ("距離 G:i:s Y-n-d 還有" ,$nextDay10am); } echo '
'; echo ((int)($timeRemain/(24*60*60))).'天 '.((int)($timeRemain/60/60)%24).'小時'.((int)($timeRemain/60)%60).'分'.($timeRemain%60).'秒'; ?> 經過 mktime ,返回的是UNIX時間戳記,不會有 +1 的問題。

其他解答:

arrow
arrow
    創作者介紹
    創作者 ohe09nz81r 的頭像
    ohe09nz81r

    ohe09nz81r的部落格

    ohe09nz81r 發表在 痞客邦 留言(0) 人氣()