PB計算倒計時剩餘時間問題小函式(原創,給懶人用)

2021-04-01 22:35:58 字數 821 閱讀 4484

函式:

global type f_getdaysorhours from function_object

end type

forward prototypes

global function string f_getdaysorhours (datetime argstopdatetime)

end prototypes

global function string f_getdaysorhours (datetime argstopdatetime);string ls_daysorhours

long ll_days,ll_hours

ll_days = daysafter(date(today()),date(argstopdatetime))

if ll_days > 0 then

ls_daysorhours = "還剩:" + string(ll_days) + "天"

elseif ll_days = 0 then

ll_hours = hour(time(argstopdatetime)) - hour(now())

if ll_hours > 0 then

ls_daysorhours = "還剩:" + string(ll_hours) + "小時"

else

ls_daysorhours = "沒有可用時間!!"

end if

else

ls_daysorhours = "沒有可用時間!!"

end if

return ls_daysorhours

end function

lua 計算倒計時,天 周 月倒計時

通過伺服器時間 獲得明天零點的時間戳 function getnextdayzerotime timenum 獲得當前伺服器的時間 local t1 timenum if not t1 then t1 systemtime end 獲得時間格式 local tab os.date t t1 tab....

倒計時 心跳倒計時

我從悶熱的午後醒來,可還是頭痛得厲害,睡意再次湧上心頭,我告訴自己不能再昏睡下去,於是決定出門去清醒一下。現在的天氣雖說有些燥熱,但是陰涼處還是比較涼爽,我慢慢地走,接著慢跑了起來,夕陽散發著最後一縷餘暉。我邊看著眼前的城市邊際的美景邊深呼吸著,隨著耳機裡傳來的 律動著。突然有個聲音從我腦海裡響起,...

js倒計時,秒倒計時,天倒計時

html 1 html 2 距某某開幕式還有 天 html html html id timer style color red 這次利用系統時間自校驗倒計時,無需手工調校使得倒計時更為精確,及詳細註釋如下 id clock 00 01 11 00 id startb type button val...

php mysql倒計時 php 倒計時程式

測試頁面 獲取系統時間,將時間以指定格式顯示到頁面。function systemtime 獲取系統時間。var datetime new date var yy datetime.getfullyear var mm datetime.getmonth var dd datetime.getdat...

js 多個倒計時,毫秒倒計時

其實主要是借鑑了了這篇文的寫法 俺稍作了修改,以便更適合我的需要 實現功能 呼叫一個函式,傳入html元素的id,和一個截止時間 unix時間戳 在該html元素中列印出到當前到截止時間為止的倒計時,精確到毫秒 效果圖如下 h2 毫秒的倒計時 h2 div id timer1 div div id ...