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

1367Re: Fraction of days, ISO-8601 2005

Expand Messages
  • johnmsteele
    Sep 14, 2005
    • 0 Attachment
      --- In ISO8601@yahoogroups.com, hjwoudenberg@a... wrote:
      > When I round trip a date and time to fraction of days, the round
      trip is
      > only approximate the same.
      > hjw

      Broadly, two ways of handling:

      Others have touched on the idea of using seconds, (which Unix does)
      and there are variants:
      1) Just use seconds as the fundamental interval. When days are
      needed, recover days as INT(SECS/86400) and seconds_within_day = MOD
      (SECS, 86400)
      2) Use two words, one for days, one for seconds within days (may help
      get over precision issues)
      This would extend to any "tic" which is a submukltiple of a second,
      like milliseconds. (You don't say how fine a time interval you must

      The second option is to always round your answer. That requires
      knowing an acceptable resolution and carrying enough precision.

      If 1 second resolution suffices, there are 86400 s/day, and you have
      to carry AT LEAST 5 decimals in your day fraction. I would strongly
      recommend a guard digit, so use six digits. If you want milliseconds,
      nine digits in the fraction. Then when you go back to seconds, force
      round it to the resolution you have chosen.
    • Show all 8 messages in this topic