I am using the following code in B4i: (using DateUtils)
Dim diff As Period
DateTime.DateFormat="dd.MM.yyyy HH:mm:ss"
diff = DateUtils.PeriodBetweenInDays(DateTime.Now, DateTime.DateParse("27.07.2016 23:59:59"))
Label1.Text = diff.Days
In order to tell you the exact compiler errors with line numbers I put in the same code again. And hey, now it works!
I do not know what was wrong before. Nevertheless it works.
So it was just a successful test how to share code between B4i and B4A.
Thanks for your effort.