For B4J we have dateUtils, so to calculate the DateDiff between two dates in days...
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
For some reason the result is 3 and not 32
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
Is there something Im perhaps doing wrong in my formula?
Thanks
			
			
			
				B4X:
			
		
		
		Sub DateDiff(CurrentDate As String, OtherDate As String) As Int
    DateTime.DateFormat = "yyyy-MM-dd"
    
    Dim CurrDate As Long
    Dim OthDate As Long
    CurrDate = DateTime.DateParse(CurrentDate)
    OthDate = DateTime.DateParse(OtherDate)
    '
    Log("*currdate*")
    Log(CurrDate)
    Log("*othdate")
    Log(OthDate)
    Log("*ticks per day")
    Log(DateTime.TicksPerDay)
    Dim iOut As Int = CurrDate - OthDate
    Dim nDays As Int = BANano.parseint(iOut) / DateTime.TicksPerDay
    Return nDays
End Sub
	For some reason the result is 3 and not 32
			
				B4X:
			
		
		
		current date: 2020-03-31
other date: 2020-02-28
app1582936210201.js:64303 *currdate*
app1582936210201.js:64305 1585605600000
app1582936210201.js:64307 *othdate
app1582936210201.js:64309 1585346400000
app1582936210201.js:64311 *ticks per day
app1582936210201.js:64313 86400000
	Is there something Im perhaps doing wrong in my formula?
Thanks