If 1st cell is A1 and 2bd cell is B1 then
=TEXT(DATEDIF(A1;B1+1;"y"); "00") & "-" & TEXT(DATEDIF(A1;B1+1;"ym");"00") & "-" & TEXT(DATEDIF(A1;B1+1;"md");"00")
Update Yes, we can record a period for a whole set of ranges. The formula will be very long and difficult to understand.
For example, if your start and end dates are in columns B and C, as in the attached spreadsheet, then the formula would be:
=TEXT(DATEDIF(MIN(B2:C32);MIN(B2:C32)+SUMPRODUCT(C2:C32-B2:B32+1)+1;"y"); "00") & "-" & TEXT(DATEDIF(MIN(B2:C32);MIN(B2:C32)+SUMPRODUCT(C2:C32-B2:B32+1)+1;"ym");"00") & "-" &
TEXT(DATEDIF(MIN(B2:C32);MIN(B2:C32)+SUMPRODUCT(C2:C32-B2:B32+1)+1;"md");"00")
In this spreadsheet, I tried to describe in detail the sequence of reasoning - maybe I was mistaken somewhere, an analysis of the actions will allow you to find the error. DateIntervalsInYMD.ods