I found the problem is not in scheduling services but in datetime.
The issue is caused by the difference in time zones.
Specifically, I live in Italy and now we've 2 hours offset (1+1DST).
In fact if i try to schedule the service between 0:00 and 2:00 AM it doesn't work.
It seems that
DateTime.TimeParse(Hour & ":" & Minute & ":00")
gives back a tick meaning it's "yesterday", so even if I add 1 day it comes to today.
I also did some test changing the time on my phone and this code:
Hour = 1
Minute = 0
Msgbox("Time = " & DateTime.Time(DateTime.TimeParse(Hour & ":" & Minute & ":00")) & "Time parse = " & DateTime.TimeParse(Hour & ":" & Minute & ":00"),"") '& "data = " & DateTime.Date(zz),True)
give me different result if time on my phone is before or after 2:00 AM... "Time = 01:00" is always correct, but the tick coming from TimeParse is different.
I also tried setting
DateTime.SetTimeZone(DateTime.GetTimeZoneOffsetAt(DateTime.Now))
but nothing changed.:sign0148:
I can't believe that this can't be fixed so i hope I'm really doing something wrong...
Please help me :sign0085: