History
This calculator was originally developed several years ago as an in-house tool which we used in preparing XBRL documents for EDGAR filings. At the time there were no tools of this sort available so we shared it online for others to use as well.
Some Theory and How to Use
XBRL facts representing periods of time are in the durationItemType Data Type which is entered in the 'PnYnMnDTnHnMnS' format also known as ISO 8601 Duration Format. For example, the XBRL element DebtInstrumentTerm is defined “Period of time between issuance and maturity of debt instrument, in PnYnMnDTnHnMnS' format, for example, 'P1Y5M13D' represents the reported fact of one year, five months, and thirteen days.”
Typically these facts were represented as decimal numbers. If the term is four years, the number entered in the financial statement by the accountant might be 4.0 which converts easily to P4Y. Simple for any XBRL preparer. However, facts representing time remaining are more complicated. For example, you might have “Weighted-Average Remaining Life in Years” (element Sharebased Compensation Arrangement By Sharebased Payment Award Options Outstanding Weighted Average Remaining Contractual Term2) for some Stock Options, where it's some odd amount like 6 years and 18 days which the accountant has entered as 6.05. How does one convert that to durationItemType? That's what this conversion program below does.
Enter the decimal value that you would like to convert to ISO 8601 format (example: 4.27)
Input date:
Converts to: years, 0 months, 0 days
Conversion to durationItemType: PY0M0D
Programming Note: the conversion was based on a 365-day year and a 30.416667 day month (365/12)