Understanding%20ISO%208601%20date%20and%20time%20representation%20formats - PowerPoint PPT Presentation

About This Presentation
Title:

Understanding%20ISO%208601%20date%20and%20time%20representation%20formats

Description:

21st International Unicode Conference 3 Dublin, Ireland, May 2002. Brief Overview of ISO 8601 ... 21st International Unicode Conference 5 Dublin, Ireland, May 2002 ... – PowerPoint PPT presentation

Number of Views:400
Avg rating:3.0/5.0
Slides: 30
Provided by: xenc3
Category:

less

Transcript and Presenter's Notes

Title: Understanding%20ISO%208601%20date%20and%20time%20representation%20formats


1
Understanding ISO 8601 date and time
representation formats
  • Tex Texin
  • Tex_at_I18nGuy.com
  • XenCraft

2
Objectives for this session
  • ISO 86011988 is updated in 2000.
  • What is in ISO 86012000?
  • Are there potential pitfalls in using ISO 8601,
    especially for internationalization?
  • If so, are there workarounds?

3
Agenda
Brief Overview of ISO 8601 Problem
Areas Solutions
4
ISO 86012000 Overview
  • Dates
  • Calendar dates
  • Ordinal dates
  • Week dates
  • Time of day
  • Local vs. Coordinated Universal Time (UTC)
  • Combined date and time
  • Time-intervals
  • Recurring time-intervals

5
Representing dates, times, durations and intervals
  • Uses character representation
  • ISO/IEC 646 (ASCII), no spaces
  • Separators (Extended Format)
  • Hyphens, Colons, Solidus, Number sign
  • Truncation
  • Omission of higher order components
  • Reduced Precision
  • Omission of lower order components
  • Expansion- years lt 0 or years gt 9999
  • Fixed length fields using leading zeros

6
Representing dates, times, durations and intervals
  • Designators
  • P is time-interval designator
  • R is recurring time-interval designator
  • T indicates start of Time elements
  • W is week designator
  • Z is UTC designator
  • Duration designators
  • Y, M, W, D, H, M, S may be used
  • M can be minute, month, or both

7
Calendar Dates
  • Gregorian calendar
  • 1875 is reference point
  • Common (365) and Leap (366) years
  • Leap is every 4th year except centennial years
    that are not integrally divisible by 400
  • Gregorian is used even for years lt 1582 (by
    mutual agreement).
  • Year 0000 is leap.

8
Calendar week
  • Monday is day 1, Sunday is day 7.
  • Weeks are numbered 1- 52 or 1 - 53.
  • Week 1 includes the first Thursday of year.
  • Alternatively, Week 1 includes Jan 4.
  • Week 1 may include 3 days of last year.
  • Last week may include 3 days of next year.

9
Representing dates
  • Calendar date
  • year, month, day number within month
  • Ordinal date
  • year, day number within year
  • Week date
  • year, week, number within week

10
Representing dates
11
ISO 86012000 Overview
  • Dates
  • Calendar dates
  • Ordinal dates
  • Week dates
  • Time of day
  • Local vs. Universal Time Coordinated (UTC)
  • Combined data and time
  • Time-intervals
  • Recurring time-intervals

12
Representing times
  • Hours 00-24 (allowing midnight-midnight)
  • Minutes 00-59
  • Seconds 00-60 (allowing leap seconds)
  • Decimal fractions of hour, minute, second
  • Local and Universal (UTC) time

13
Representing times
14
Combined date and time
  • T indicates start of time
  • Mix and match as needed
  • Calendar dates local time
  • YYYY-MM-DDThhmm
  • Ordinal dates UTC time
  • YYYY-DDDThhmmZ
  • Week dates offset from UTC
  • YYYYWwwDThhmmhhmm

15
ISO 86012000 Overview
  • Dates
  • Calendar dates
  • Ordinal dates
  • Week dates
  • Time of day
  • Local vs. Universal Time Coordinated (UTC)
  • Combined data and time
  • Time-intervals
  • Recurring time-intervals

16
Representing time-intervals
  • P indicates a duration (period)
  • Intervals come in 4 varieties
  • start and end times
  • YYYY-MM-DDThhmmss/YYYY-MM-DDThhmmss
  • durations
  • PnYnMnDTnHnMnS
  • P2Y10M15DT10H30M20S
  • 2 Yr, 10 mon, 15 days, 10 hrs. 30 min. 20 sec.
  • P6W is a duration of 6 weeks.

17
Representing time-intervals
  • The remaining 2 varieties
  • start time and duration
  • YYYY-MM-DDThhmmss/PnYnMnDTnHnMnS or
  • YYYY-MM-DDThhmmss/PYYYY-MM-DDThhmmss
  • 1985-04-12T232050/P0001-02-15T123000
  • duration and end time
  • PnYnMnDTnHnMnS/YYYY-MM-DDThhmmss or
  • PYYYY-MM-DDThhmmss/YYYY-MM-DDThhmmss

18
Recurring time-intervals
  • Recurring time intervals are expressed by
  • of recurrences and start and end times
  • of recurrences and a duration
  • of recurrences start time a duration
  • of recurrences duration end time
  • If of recurrences is not provided, then the
    number is unbounded
  • R is used to indicate recurrence

19
Examples of recurring time-intervals
Recurring with Start and End Times Rn/YYYY-MM-DDT
hhmmss/YYYY-MM-DDThhmmss R12/1985-04-12T2320
50/1985-06-25T103000 Recurring with a
duration Rn/PnYnMnDTnHnMnS R12/P2Y10M15DT10H20M20
S Recurring with a Start Time and
duration Rn/YYYY-MM-DDThhmmss/PnYnMnDTnHnMnS R1
2/1985-04-12T232050/P2Y2M15DT12H30M0S
20
Benefits of ISO 8601
  • Human-readable
  • Easy to use
  • Easy to parse, unambiguous
  • Easy to sort
  • Many date-time schemes exist, a standard is needed

21
Agenda
Brief Overview of ISO 8601 Problem
Areas Solutions
22
Ambiguities
  • Future leap seconds are unpredictable
  • Is 2010-03-31T235960Z valid?
  • Year, month, minute have varying sizes
  • P1M P28D or P29D or P30D or P31D
  • Mismatched precision
  • 1985W50 lt 1985W501?
  • Truncation opens the door for Y2K issues
  • Variations of 8601 exist in practice
  • Julian, Gregorian, Emperor...

23
Ambiguities
  • Date arithmetic is not defined
  • 2001-03-30 P1M 2001-04-29 (Add 30 days)
  • 2001-03-30 P1M 2001-04-30 (Add 1 mon.)
  • Addition is not commutative or associative
  • 2001-03-30 P1D P1M 2001-04-30
  • 2001-03-30 P1M P1D 2001-05-01
  • Subtraction is not the inverse of Addition
  • Precision of decimal fractions can vary

24
Conversions
  • Gregorian calendar adopted at different times
    around the world
  • Most calendars do not include year 0.
  • 8601 extends leap years into the past, other
    calendars do not.
  • Dates without times are often not qualified by
    time zone.
  • Time zones (currently) go from -13 to 12
  • So the date could be /- 1 day

25
Conversions
  • Laws determining daylight savings time change
    continually
  • Difficult to know local time offsets.

26
Agenda
Brief Overview of ISO 8601 Problem
Areas Solutions
27
Solutions
  • Mutual Agreements
  • Referencing other standards and implementations
  • e.g. Java
  • Standards employing 8601 may need to introduce
    rules or constraints
  • e.g. XML Schema
  • Restrict use of 8601 formats

28
Acknowledgements
  • Mark Davis (IBM)
  • www.macchiato.com/unicode/timeIntervals.htm
  • W3C Internationalization working and interest
    groups
  • Resources
  • ISOs web page to order the standard
    http//www.iso.ch/cate/d26780.html
  • Mail list ISO8601_at_yahoogroups.com
  • Links
  • groups.yahoo.com/group/ISO8601/files/pdf_link.htm
  • http//aa.usno.navy.mil/faq/docs/UT.html

29
Questions
?
Write a Comment
User Comments (0)
About PowerShow.com