How to write code for time, for example 10:00 to 12:00, but the time really matches the system time ?
active time will start at 10:00 and end after exceeding 12:00
How to write code for time, for example 10:00 to 12:00, but the time really matches the system time ?
active time will start at 10:00 and end after exceeding 12:00
How to write code for time, for example 10:00 to 12:00, but the time really matches the system time ?
active time will start at 10:00 and end after exceeding 12:00
i believe you want it to start in the background right?
if so you can use a service and start it at a specific time like 10:00 and do what you want to do.
it is hard to understand what you want to archive from your short post.
what should happen between 10:00 to 12:00?
i believe you want it to start in the background right?
if so you can use a service and start it at a specific time like 10:00 and do what you want to do.
it is hard to understand what you want to archive from your short post.
what should happen between 10:00 to 12:00?
this will not work. you need to convert text to long and check if something is bigger or not like this:
B4X:
DateTime.TimeFormat = "HH:mm"
Dim lbl1 As Label
lbl1.Initialize("")
lbl1.Text = DateTime.Time(DateTime.Now)
Dim startTime As String = "10:00"
Dim endTime As String = "12:00"
If DateTime.TimeParse(lbl1.Text) > DateTime.TimeParse(startTime) And DateTime.TimeParse(lbl1.Text) < DateTime.TimeParse(endTime) Then
Log($"Yes, you are between ${startTime } and ${endTime}"$)
Else
Log($"NO, you are not between ${startTime } and ${endTime}"$)
End If
this will not work. you need to convert text to long and check if something is bigger or not like this:
B4X:
DateTime.TimeFormat = "HH:mm"
Dim lbl1 As Label
lbl1.Initialize("")
lbl1.Text = DateTime.Time(DateTime.Now)
Dim startTime As String = "10:00"
Dim endTime As String = "12:00"
If DateTime.TimeParse(lbl1.Text) > DateTime.TimeParse(startTime) And DateTime.TimeParse(lbl1.Text) < DateTime.TimeParse(endTime) Then
Log($"Yes, you are between ${startTime } and ${endTime}"$)
Else
Log($"NO, you are not between ${startTime } and ${endTime}"$)
End If