Sub check_night_silent_conditions()As Boolean
Dim under As Long
Dim above As Long
Dim timenow As Long
DateTime.TimeFormat = "HH:mm:ss"
under = DateTime.TimeParse("06:00:00")
above = DateTime.TimeParse("23:59:59")
timenow = DateTime.now
If under < timenow Then 'below 6 in the morning
hd.ToastMessageShow("Sterownik nie zezwoli","CISZA NOCNA!")
Return False
Else
If above > timenow Then 'above 22 of the night
hd.ToastMessageShow("Sterownik nie zezwoli","CISZA NOCNA!")
Return False
End If
End If
Return True
End Sub