If internal_isTurnedOn And Right(LCase(internal_CurrentUser), 8) = "lastname" Then
Dim value: value = CDate(InputBox("enter the date and time (hh:mm)", "please", FormatDateTime(Time, 4)))
' validate the input here
internal_Time = CDate(value)
Else
internal_Time = CDate(Time)
End If
我得到輸入框,無論輸入什麼值,它都給我當前時間。 我希望默認保持當前時間(顯示),但如果用戶將其更改爲另一個值,那麼我想改變的值爲什麼總是給我當前時間
更新到CODE
If internal_isTurnedOn And Right(LCase(internal_CurrentUser), 8) = "lastname" Then
Dim value
value = CDate(InputBox("Please enter the time (hh:mm)", "Time Input", FormatDateTime(Now, 4)))
internal_Time = CDate(FormatDateTime(value, 4))
Else
internal_Time = FormatDateTime(Time, 4)
End If
不過現在我正在正確的時間我已輸入,但它添加了一些額外的不需要的東西,如秒和上午/下午。無論如何,只需要以軍事形式獲得時間?
爲了獲得軍事時間,將第四行更改爲:internal_Time = FormatDatetime(CDate(value),4) – PaulStock