Dim timezone As Long
Dim ret as long
timezone = DateTime.DateParse("01/01/1970 00:00:00")
ret = DateTime.TimeParse("16:13:00") + timezone
Log (DateTime.Time(ret))
There may still be a small related problem here. Early this morning Tue. at 12:08am datetime.timeparse returned the right time but if you do a datetime.date on the ticks result it gives you Mon. and not Tue. This morning it works fine.
With a timezone of GMT+2 the wrong date is returned (via ticks) when the device time is b/w 12:00am and 2:00am. If I change timezone to GMT all is fine.
Seems to me it is all related... my problem, the above bug and the link you provided.
Dim fulldatetime As Long
Dim date as String
fulldatetime=DateTime.TimeParse("06:00:00")
date=DateTime.Date(fulldatetime)
The test case a bit more involved.
The problem is that the ticks returned by datetime.timeparse are incorrect when the device time is within the timezone correction. Incorrect because the date is incorrect, the time on the contrary is correct.
For example. If code above is run on 6/14/12 the date above should always be 6/14/12. However if your device is set for the timezone GMT+2 then when the device time is in between 12:00am and 2:00am the date returned is not 6/14/12 but 6/13/12. As bobsimoneau mentioned, he is in timezone GMT-4 and he sees this behavior between 8pm and 12am.
Looking at the value of fulldatetime you can see the problem is with datetime.timeparse()