Sub timer1_Tick
Dim datetoday As String
DateTime.DateFormat="M/d/yyyy HH:mm:ss"
datetoday=DateTime.Date(DateTime.Now)
For i = 1 To 10
WriteTextWriter(Ax&","&Ay&","&Az&","&datetoday)
Next
End Sub
I would like the timer to write this values between 10am and 4pm every day. How can i loop using time?
You would initialize and enable the timer to your required interval when the app starts. But if you want to start and end at a specific time each day, you should look at using a service which you can start at a specific time using StartServiceAt
How do you check if time is greater than? i tried the following but it gives me an error =>java.lang.NumberFormatException:invalid double: "07:38"
B4X:
lblStartSet.Text=txtStartTime.Text
lblStopSet.Text=txtEndTime.Text
timer1.Initialize("Timer1", 5000)
Dim timenow,starttime As Long
starttime=DateTime.TimeParse(lblStartSet.Text)
DateTime.TimeFormat="HH:mm"
timenow=DateTime.Time(DateTime.Now)
If starttime>=timenow Then
timer1.Enabled = True
End If