DATEDIF

この関数は開始日と終了日の間の日数や月数、年数を返します。

tip

この関数はLibreOffice 3.6以降で利用できます。


note

This function is part of the Open Document Format for Office Applications (OpenDocument) standard Version 1.2. (ISO/IEC 26300:2-2015)


構文

DATEDIF(Start date; End date; Interval)

開始日 は計算を開始する日付です。

終了日 は計算を終了する日付です。終了日は開始日よりも後ろの日付である必要があります。

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

When entering dates as part of formulas, slashes or dashes used as date separators are interpreted as arithmetic operators. Therefore, dates entered in this format are not recognized as dates and result in erroneous calculations. To keep dates from being interpreted as parts of formulas use the DATE function, for example, DATE(1954;7;20), or place the date in quotation marks and use the ISO 8601 notation, for example, "1954-07-20". Avoid using locale dependent date formats such as "07/20/54", the calculation may produce errors if the document is loaded under different locale settings.


tip

Unambiguous conversion is possible for ISO 8601 dates and times in their extended formats with separators. If a #VALUE! error occurs, then unselect Generate #VALUE! error in - LibreOffice Calc - Formula, button Details... in section "Detailed Calculation Settings", Conversion from text to number list box.


"間隔"の値

戻り値

"d"

開始日と終了日の間の満日数

"m"

開始日と終了日の間の満月数

"y"

開始日と終了日の間の満年数

"ym"

開始日と終了日の間の年の違いを考慮しない月数

"md"

開始日と終了日の間の年と月の違いを考慮しない日数

"yd"

開始日と終了日の間の年の違いを考慮しない日数


誕生日の計算です。1974-04-17に生まれた人がいて、今日の日付を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")は13937を返します。彼が生まれて13937日経つということになります。

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


Date & Time Functions

DATE

DATEDIF

DATEVALUE

DAY

DAYS

DAYS360

DAYSINMONTH

DAYSINYEAR

EASTERSUNDAY

EDATE

EOMONTH

HOUR

ISLEAPYEAR

[text/scalc/01/func_isoweeknum.xhp#isoweeknum not found].

MINUTE

MONTH

MONTHS

NETWORKDAYS

NETWORKDAYS.INTL

NOW

SECOND

TIME

TIMEVALUE

TODAY

WEEKDAY

WEEKNUM

WEEKNUM_ADD

[text/scalc/01/func_weeknum_ooo.xhp#weeknum_ooo not found].

WEEKS

WEEKSINYEAR

WORKDAY

WORKDAY.INTL

YEAR

YEARFRAC

YEARS

ご支援をお願いします!