I'm trying to calculate the mins between two date/times then use the value to be entered into my database.
A button is pressed to start a game. Start Time is recorded. A different button is pressed to end a game, End Time is recorded. I want to calc the mins between the Start Time and the End Time.
Getting an error of 'Unparseable date: "1427298075389" (at offset 13)'
Many Thanks
P
A button is pressed to start a game. Start Time is recorded. A different button is pressed to end a game, End Time is recorded. I want to calc the mins between the Start Time and the End Time.
B4X:
Sub Globals
Dim str_StartTime as String, str_EndTime as String, str_Duration as String
End Sub
Sub btn_Start_click
str_StartTime = DateTime.Now
End Sub
sub btn_End_click
str_EndTime = DatTime.Now
End Sub
Sub Duration (StartTime as String, EndTime as String)
DateTime.SetTimeZone(0)
DateTime.DateFormat = "d MMM yyyy hh:mm"
Return (DateTime.DateParse(str_EndTime) - DateTime.DateParse(str_StartTime)) / DateTime.TicksPerMinute
End Sub
INSERT INTO table VALUES(str_Duration)
Getting an error of 'Unparseable date: "1427298075389" (at offset 13)'
Many Thanks
P