PB9.0如何動態獲取系統時間
阿新 • • 發佈:2018-12-24
pb9.0如何獲取系統時間?
要實時跟蹤顯示的那種
在視窗Open事件中寫
st_1.text = STring(today(),'yyyy-mm-dd') + " " + String(now(),'hh:mm:ss')
timer(1)
在視窗的timer事件中寫
st_1.text = string(today(),'yyyy-mm-dd')+ " " + string(now(),'hh:mm:ss')
執行OK!
//加星期的
st_1.text = STring(today(),'yyyy-mm-dd') + " " + String(now(),'hh:mm:ss')+" " + ge_week()
timer(1)
//定義獲取星期的函式 函式名稱ge_week()
int liWeek;
string ls_week
liWeek = DayNumber(today())
choose case liWeek
case 1
ls_week = "星期天"
case 2
ls_week = "星期一"
case 3
ls_week = "星期二"
case 4
ls_week = "星期三"
case 5
ls_week = "星期四"
case 6
ls_week = "星期五"
case 7
ls_week = "星期六"
end choose
return ls_week
要實時跟蹤顯示的那種
在視窗Open事件中寫
st_1.text = STring(today(),'yyyy-mm-dd') + " " + String(now(),'hh:mm:ss')
timer(1)
在視窗的timer事件中寫
st_1.text = string(today(),'yyyy-mm-dd')+ " " + string(now(),'hh:mm:ss')
執行OK!
//加星期的
st_1.text = STring(today(),'yyyy-mm-dd') + " " + String(now(),'hh:mm:ss')+" " + ge_week()
timer(1)
//定義獲取星期的函式 函式名稱ge_week()
int liWeek;
string ls_week
liWeek = DayNumber(today())
choose case liWeek
case 1
ls_week = "星期天"
case 2
ls_week = "星期一"
case 3
ls_week = "星期二"
case 4
ls_week = "星期三"
case 5
ls_week = "星期四"
case 6
ls_week = "星期五"
case 7
ls_week = "星期六"
end choose
return ls_week