# help with dates

##### Member
I have two input vars. from user using the calendar control, i want to know how many days are between the two dates, and (assign the value to another var. this part i know). Thank you for any help. I love this program, i have been using it for about a week.

Again Thank you
sue

#### Cableguy

##### Expert
You wil need to do 2 operations, first get the date equivalent in ticks...(for both dates), then subtract the dates...this gets you the icks bettwen the dates...
Overall,something likethis...

B4X:
``daydif=(DateParse(date2)-DateParse(date1))/(86400*10000000)``
Date2: the newst date
date1: the oldestdate
daydif=(DateParse(date2)-DateParse(date1)) gets the tick value diference bettween dates
86400*10000000) is the number of tick in 1 day...

#### Erel

Staff member
There is no need to use DateParse as the date comes from the Calendar control:
B4X:
``daydif = (Calendar1.Value - Calendar2.Value) / cTicksPerDay``
cTicksPerDay is a constant. Its value is the number of ticks in one day.
If you want a whole number of days use:
B4X:
``daydif = Int((Calendar1.Value - Calendar2.Value) / cTicksPerDay)``