VBA - 二次函式



Second 函式返回一個介於 0 到 59 之間的值,該值表示指定時間戳的時分。

語法

Second(time) 

示例

新增一個按鈕並新增以下函式。

Private Sub Constant_demo_Click()
   msgbox("Line 1: " & Second("3:13:25 PM"))
   msgbox("Line 2: " & Second("23:13:45"))
   msgbox("Line 3: " & Second("2:20 PM"))
End Sub

執行上述函式時,將產生以下輸出。

Line 1: 25
Line 2: 45
Line 3: 0
vba_date_time.htm
廣告
© . All rights reserved.