DATEDIF

This function returns the number of whole days, months or years between Start date and End date.

tip

Ця фукція доступна з версії LibreOffice 3.6.


note

Ця функція є частиною стандарту Open Document Format for Office Applications (OpenDocument) версії 1.2. (ISO/IEC 26300:2-2015)


Syntax

DATEDIF(Start date; End date; Interval)

Start date is the date from when the calculation is carried out.

End date is the date until the calculation is carried out. End date must be later, than Start date.

Interval is a string that determines how the difference will be calculated. Possible values are "d", "m", "y", "ym", "md" or "yd" regardless of the current language settings.

note

При введенні дат як частини формул, косі риси або тире, використовувані в якості роздільників дат, інтерпретуються як арифметичні оператори. Тому дати, введені в цьому форматі не розпізнаються як дати і призводять до помилкових обчислень. Щоб дати не інтерпретувалися як частини формул, використовуйте функцію DATE, наприклад DATE (1954;7;20) або помістіть дату в лапки і використовуйте нотацію ISO 8601, наприклад "1954-07-20". Уникайте використання форматів дати, що залежать від локальних налаштувань, таких як "07/20/54", оскільки розрахунок може призвести до помилок, якщо документ завантажено відповідно до інших локальних налаштувань.


tip

Неоднозначне перетворення можливе для дат і часу ISO 8601 в розширених форматах з роздільниками. Якщо виникає помилка #ЗНАЧЕННЯ!, змініть вибір Генерувати хибу #ЗНАЧЕННЯ! у вікні - LibreOffice Calc - Формула, кнопка Детальніше... у розділі "Детальні налаштування обчислень", у списку Перетворення із тексту у число.


Value for "Interval"

Return value

"d"

Number of whole days between Start date and End date.

"m"

Number of whole months between Start date and End date.

"y"

Number of whole years between Start date and End date.

"ym"

Number of whole months when subtracting years from the difference of Start date and End date.

"md"

Number of whole days when subtracting years and months from the difference of Start date and End date.

"yd"

Number of whole days when subtracting years from the difference of Start date and End date.


Приклади

Birthday calculation. A man was born on 1974-04-17. Today is 2012-06-13.

=DATEDIF("1974-04-17";"2012-06-13";"y") yields 38.

=DATEDIF("1974-04-17";"2012-06-13";"ym") yields 1.

=DATEDIF("1974-04-17";"2012-06-13";"md") yields 27.

So he is 38 years, 1 month and 27 days old.

=DATEDIF(DATE(1974,4,17);"2012-06-13";"m") yields 457, he has been living for 457 months.

=DATEDIF("1974-04-17";"2012-06-13";"d") yields 13937, he has been living for 13937 days.

=DATEDIF("1974-04-17";DATE(2012;06;13);"yd") yields 57, his birthday was 57 days ago.

Будь ласка, підтримайте нас!