days dif code....

MichaelTJ

Member
Licensed User
Longtime User
i need to get the number of days between 130515 and 130427.... could someone please give me the code that would yield this "number of days"? thank you
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
You should use DateUtils. Starting from v2.70 (beta) it is included as a library. For previous versions you should download the code module from the forum:
B4X:
Sub Activity_Create(FirstTime As Boolean)
   DateTime.DateFormat = "yyMMdd"
   Dim startDate As Long = DateTime.DateParse("130427")
   Dim endDate As Long = DateTime.DateParse("130515")
   Dim p As Period = DateUtils.PeriodBetweenInDays(startDate, endDate)
   Log(p.Days)
End Sub
 
Upvote 0
Top