Android Question Date comparison broken code

Sub7

Active Member
Licensed User
Longtime User
Why this code fails?
I want calculate years between two dates:

B4X:
  Dim bday As String = "19771126" 'i pick dates from wievs.
  Dim today As String = "20131205"
  Dim startDate As Long = DateTime.DateParse(bday)
  Dim endDate As Long = DateTime.DateParse(today)
  Dim diff As Period = DateUtils.PeriodBetween(endDate, startDate)
  Log(diff.Years)
LastException java.text.ParseException: Unparseable date: "20081206" at offset(8)

ty
 
Top