Can you check my coding? When I run the app if the start time is 23:00 and the end time is 23:59 I would expect the toast message to say the time now is outside the start and end times. That works but when I change the start time to 02:00 I still get a toast messages stating the same thing. Did I make a mistake on the coding?
B4X:
If kvs.get("UserDisabledMuteSunday") = False Then
intStartTimeTicks = DateTime.TimeParse(kvs.Get("SundayRow1StartTime"))
intEndTimeTicks = DateTime.TimeParse(kvs.Get("SundayRow1EndTime"))
If DateTime.Now >= intStartTimeTicks And DateTime.Now <= intEndTimeTicks Then
ToastMessageShow("It's in between", False)
RemuteSounds
Else
ToastMessageShow("It's outside the peroid", False)
RestoreSounds
End If
Else
RestoreSounds
End If
I checked DateTime.Now ticks is a huge number compared to the ticks value for 02:00 which was in SundayRow1StartTime. How do I just parse the time so I can get only the ticks value for the current time on today's date?
If you have time, can you change my coding so I can do the comparisons correctly?
Use a string. put the todays date in. Use Datetime.ParseDateAndTime using your Datestring and the timestring you got from kvs... Compare the result with Datetime.now