Android Question DateTime parse error

Declan

Well-Known Member
Licensed User
Longtime User
I am attempting to parse DateTime from a string with:
B4X:
Dim MyStartDate As String
Dim MyStartTime As String
MyStartDate = sf.Left(Main.MyBookStart,10)
MyStartTime = sf.Mid(Main.MyBookStart,12,8)

    Log("Start Date: " & MyStartDate)
    Log("Start Time: " & MyStartTime)

DateTime.DateFormat = "dd-MM-yyyy HH:mm:ss"
Dim t As Long = DateTime.DateTimeParse(MyStartDate,MyStartTime)

My Log is:
B4X:
Start Date: 04-09-2016
Start Time: 05:49:09

I receive the following error:
B4X:
java.text.ParseException: Unparseable date: "04-09-2016" (at offset 10)
 
Top