Loading ...
Sorry, an error occurred while loading the content.

Time span format

Expand Messages
  • danielbsig <dabs@ru.is>
    I haven t found a definite answer to my question, which is: How would I format a time span value? What I need is to express a time span value as a string.
    Message 1 of 6 , Dec 11, 2002
    • 0 Attachment
      I haven't found a definite answer to my question, which is: How would
      I format a time span value? What I need is to express a time span
      value as a string. This value does not have any specific start or
      end time but rather a span - i.e. 3 hours, 5 minutes and 12 seconds.
      Can anyone tell me if this is defined somewhere in ISO 8601?

      With best regards,
      Daniel
    • Tex Texin
      Yes, you can specify a period: P indicates period, T separates date from time: PnYnMnDTnHnMnS P2Y10M15DT10H30M20S 2 Yr, 10 mon, 15 days, 10 hrs. 30 min. 20
      Message 2 of 6 , Dec 11, 2002
      • 0 Attachment
        Yes, you can specify a period:

        P indicates period, T separates date from time:

        PnYnMnDTnHnMnS
        P2Y10M15DT10H30M20S
        2 Yr, 10 mon, 15 days, 10 hrs. 30 min. 20 sec.

        P6W is a duration of 6 weeks.

        For a light overview see:
        http://www.i18nguy.com/iso8601-iuc20-texin.zip

        tex


        "danielbsig " wrote:
        >
        > I haven't found a definite answer to my question, which is: How would
        > I format a time span value? What I need is to express a time span
        > value as a string. This value does not have any specific start or
        > end time but rather a span - i.e. 3 hours, 5 minutes and 12 seconds.
        > Can anyone tell me if this is defined somewhere in ISO 8601?
        >
        > With best regards,
        > Daniel
        >
        > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

        --
        -------------------------------------------------------------
        Tex Texin cell: +1 781 789 1898 mailto:Tex@...
        Xen Master http://www.i18nGuy.com

        XenCraft http://www.XenCraft.com
        Making e-Business Work Around the World
        -------------------------------------------------------------
      • Daniel Biddle
        ... It is: see the last section of http://www.mcs.vuw.ac.nz/technical/software/SGML/doc/iso8601/ISO8601.html hope this helps, -- Daniel Biddle
        Message 3 of 6 , Dec 11, 2002
        • 0 Attachment
          On Wed, Dec 11, 2002 at 05:28:51PM -0000, danielbsig <dabs@...> wrote:
          > I haven't found a definite answer to my question, which is: How would
          > I format a time span value? What I need is to express a time span
          > value as a string. This value does not have any specific start or
          > end time but rather a span - i.e. 3 hours, 5 minutes and 12 seconds.
          > Can anyone tell me if this is defined somewhere in ISO 8601?

          It is: see the last section of
          http://www.mcs.vuw.ac.nz/technical/software/SGML/doc/iso8601/ISO8601.html

          hope this helps,
          --
          Daniel Biddle
        • Bob Neifert <bobneifert@yahoo.com>
          I concur with Tex. This form is specified in section 5.5.4.2.1 in the draft standard ISO8601:2000, available in the group file area:
          Message 4 of 6 , Dec 13, 2002
          • 0 Attachment
            I concur with Tex. This form is specified in section 5.5.4.2.1 in the
            draft standard ISO8601:2000, available in the group file area:
            http://groups.yahoo.com/group/ISO8601/files/8601v2000b.pdf

            Other applicable sections are 5.5.1 b), 5.5.2 b), 5.5.3.1. You might
            like the alternative format of 5.5.3.2, but I do not.

            Both M and Y seem ambiguous as units, but sections 4.3.1 and 5.5.3.2
            suggest that maybe P1M = P30D. I have not seen resolution on Y.

            T is not superfluous; consider P5M and PT5M. Leaving it out sometimes
            would complicate the rules.

            --- In ISO8601@yahoogroups.com, Tex Texin <tex@i...> wrote:
            > Yes, you can specify a period:
            >
            > P indicates period, T separates date from time:
            >
            > PnYnMnDTnHnMnS
            > P2Y10M15DT10H30M20S
            > 2 Yr, 10 mon, 15 days, 10 hrs. 30 min. 20 sec.
            >
            > P6W is a duration of 6 weeks.
            >
            > For a light overview see:
            > http://www.i18nguy.com/iso8601-iuc20-texin.zip
            >
            > tex
            >
            >
            > "danielbsig " wrote:
            > >
            > > I haven't found a definite answer to my question, which is: How
            would
            > > I format a time span value? What I need is to express a time span
            > > value as a string. This value does not have any specific start or
            > > end time but rather a span - i.e. 3 hours, 5 minutes and 12
            seconds.
            > > Can anyone tell me if this is defined somewhere in ISO 8601?
            > >
            > > With best regards,
            > > Daniel
          • Tex Texin
            Bob, Although suggestive, that 1M is 30D it is not conclusive and it depends on context. Many applications (and program language libraries) simply increment
            Message 5 of 6 , Dec 13, 2002
            • 0 Attachment
              Bob,
              Although suggestive, that 1M is 30D it is not conclusive and it depends
              on context.
              Many applications (and program language libraries) simply increment the
              month field, in accordance with what most people consider "next month"
              to mean. So Jan 15 becomes Feb 15, as opposed to adding 30 days which
              would make for Feb 14.
              Of course this leads to interesting confusions since months can be 28,
              29, 30 0r 31 days.

              The key is "by mutual agreement".

              hth
              tex


              "Bob Neifert " wrote:
              >
              > I concur with Tex. This form is specified in section 5.5.4.2.1 in the
              > draft standard ISO8601:2000, available in the group file area:
              > http://groups.yahoo.com/group/ISO8601/files/8601v2000b.pdf
              >
              > Other applicable sections are 5.5.1 b), 5.5.2 b), 5.5.3.1. You might
              > like the alternative format of 5.5.3.2, but I do not.
              >
              > Both M and Y seem ambiguous as units, but sections 4.3.1 and 5.5.3.2
              > suggest that maybe P1M = P30D. I have not seen resolution on Y.


              --
              -------------------------------------------------------------
              Tex Texin cell: +1 781 789 1898 mailto:Tex@...
              Xen Master http://www.i18nGuy.com

              XenCraft http://www.XenCraft.com
              Making e-Business Work Around the World
              -------------------------------------------------------------
            • Ed Davies
              ... I also don t like this format - and I don t think the authors did either hence the by mutual agreement label on this paragraph. The reason I don t like
              Message 6 of 6 , Dec 13, 2002
              • 0 Attachment
                Bob Neifert wrote:
                > ...
                > You might like the alternative format of 5.5.3.2, but I do not.

                I also don't like this format - and I don't think the authors did
                either hence the "by mutual agreement" label on this paragraph.
                The reason I don't like it is the problem with "carry-over points"
                as discussed below.

                >
                > Both M and Y seem ambiguous as units, but sections 4.3.1 and 5.5.3.2
                > suggest that maybe P1M = P30D. I have not seen resolution on Y.
                > ...

                I don't think 4.3.1 implies anything of the sort. All it says is that
                a month may be 28, 29, 30 or 31 days without indicating any preference
                as to which. 5.5.3.2 does sort of indicate 30 days but this is not very
                reliable as it is a different format from the "P" format and this
                indication is in the context of a restriction which does not apply to
                the "P" format.

                The XML Schema definition has something to say on this subject. While
                this is not a part of ISO 8601 it does show how a bunch of moderately
                careful and respected individuals choose to interpret that standard.
                It says, in section 3.2.6.2 of document xmlschema-2.html:

                > In general, the order-relation on duration is a partial order since
                > there is no determinate relationship between certain durations such
                > as one month (P1M) and 30 days (P30D).

                It actually then goes on to define the ordering somewhat. For example
                P364D < P1Y and P1Y < P367D but the relationships between P1Y and each
                of P365D and P366D are indeterminate.

                I think that if you want to indicate the duration between events which
                happen on the same day of each calendar month you should write P1M. If
                you mean an event that happens once every 30 days, irrespective of the
                length of the months then write P30D. For once every eight weeks you
                would write P56D, not something like P1M26D; the values only need to be
                positive integers, there is no restriction to the "carry-over points"
                as there is in the 5.5.3.2 format. Hence my preference for the "P"
                format.

                Ed Davies.
              Your message has been successfully submitted and would be delivered to recipients shortly.