在VB中,可以使用Now函數來獲取當前日期和時間,然后通過MsgBox函數來顯示。
以下是一個示例代碼:
Dim currentDate As Date currentDate = Now MsgBox "當前日期和時間為:" & currentDate
在上述代碼中,首先聲明一個Date類型的變量currentDate,然后使用Now函數將當前日期和時間賦值給這個變量。最后,通過MsgBox函數來顯示當前日期和時間。