DATEDIFFERENCE

Returns the difference between two dates.

start_dateThe date that represents the starting date of the period.
end_dateThe date that represents the finishing date of the period.
unitThe type of information you want returned:
"d","D" = number of days between "start_date" and "end_date"
"m","M" = number of months (whole months) between "start_date" and "end_date"
"y","Y" = number of years (whole years) between "start_date" and "end_date"
"md","MD" = number of days between "start_date" and "end_date" (ignoring months and years)
"yd","YD" = number of days between "start_date" and "end_date" (ignoring years)
"ym","YM" = number of months between "start_date" and "end_date" (ignoring days and years)
date_format(Optional) The date format "UK" or "US".

Remarks

* This is a replacement for the DATEDIF backwards compatibility function.
* If you are including the date directly then it must be enclosed in double quotes.
* The equivalent VBA function is DATEDIFFERENCE

 AB
1=JS.DATEDIFFERENCE("01 Jan 2020","04 Jan 2020","D")1/1/2020
2=JS.DATEDIFFERENCE("01 Jan 2020","1 Apr 2020","D")1/20/2020
3=JS.DATEDIFFERENCE("01 January 2020","04 Jan 2020","D") 
4=JS.DATEDIFFERENCE("01 Jan 2020","1 April 2020","D") 
5=JS.DATEDIFFERENCE("1/1/2020","4/1/2020","D") 
6=JS.DATEDIFFERENCE("1/1/2020","1/4/2020","D") 
7=JS.DATEDIFFERENCE("1/1/2020","1/4/2020","D","US") 
8=JS.DATEDIFFERENCE(1/1/2020,4/1/2020,"D") 
9=JS.DATEDIFFERENCE(1/1/2020,1/4/2020,"D") 
10=JS.DATEDIFFERENCE(1/1/2020,1/4/2020,"D","US") 
11=JS.DATEDIFFERENCE("01 Jul 2019","01 Aug 2020","d") 
12=JS.DATEDIFFERENCE(1/7/2019,1/8/2020,"d") 
13=JS.DATEDIFFERENCE(1/1/2020,20/1/2020,"D") 
14=JS.DATEDIFFERENCE("01/01/2020","01/20/2020","d") 
15=JS.DATEDIFFERENCE("01/01/2020","20/01/2020","d") 
16=JS.DATEDIFFERENCE(D1533,D1534,"d") 
17=JS.DATEDIFFERENCE("1/1/2020","1/20/2020","M") 
18=JS.DATEDIFFERENCE("1/1/2020","20/1/2020","m") 
19=JS.DATEDIFFERENCE(1/1/2020,20/4/2020,"M") 
20=JS.DATEDIFFERENCE(1/1/2020,20/4/2020,"m") 

1 - How many days are there between 1 Jan 2020 and 20 Jan 2020.


microsoft excel docs

© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext