Sub GetDayDifferenceFromToday(Ticks As Long) As Int
Dim OldFormat As String
OldFormat = DateTime.DateFormat
Dim fromDate, toDate As Long
Dim fromYear, fromMonth, fromDay, toYear, toMonth, toDay As Int
DateTime.DateFormat = "yyyy"
fromYear = DateTime.Date(DateTime.Now)
toYear = DateTime.Date(Ticks)
DateTime.DateFormat = "MM"
fromMonth = DateTime.Date(DateTime.Now)
toMonth = DateTime.Date(Ticks)
DateTime.DateFormat = "dd"
fromDay = DateTime.Date(DateTime.Now)
toDay = DateTime.Date(Ticks)
fromDate = DateUtils.SetDate(fromYear, fromMonth, fromDay)
toDate = DateUtils.SetDate(toYear, toMonth, toDay)
Dim Diff As Int
Diff = ((fromDate - toDate) / DateTime.TicksPerDay)
DateTime.DateFormat = OldFormat
Return Diff
End Sub