What is the value of the ISO 8601 duration `P1M` (in seconds)?

前端 未结 2 1659
庸人自扰
庸人自扰 2021-01-18 14:59

Suppose I have an ISO 8601 duration, expressed as \"P1M\". Phrased colloquially, this means \"one month.\" Is there a standard rule for converting this into a n

2条回答
  •  無奈伤痛
    2021-01-18 15:16

    From ISO 8601 documentation that I found (page 6 - http://xml.coverpages.org/ISO-FDIS-8601.pdf), it seems you are correct in that the number of seconds in a month cannot definitively be determined. However it does note that "In certain applications a month is regarded as a unit of time of 30 days", so depending on your application this may be a valid approach.

    The distinction between "Calendar Time" (Years, Months, etc) and "Absolute Time" (Hours, Minutes, Seconds, etc) is sometimes an important one. As an example, some people might complain about having 13 mortgage payments some years if they paid every 30 days as opposed to every month.

提交回复
热议问题