date-time.abnf 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. ; Dates
  2. date-century = 2DIGIT ; 00-99
  3. date-decade = DIGIT ; 0-9
  4. date-subdecade = DIGIT ; 0-9
  5. date-year = date-decade date-subdecade
  6. date-fullyear = date-century date-year
  7. date-month = 2DIGIT ; 01-12
  8. date-wday = DIGIT ; 1-7 ; 1 is Monday, 7 is Sunday
  9. date-mday = 2DIGIT ; 01-28, 01-29, 01-30, 01-31 based on
  10. ; month/year
  11. date-yday = 3DIGIT ; 001-365, 001-366 based on year
  12. date-week = 2DIGIT ; 01-52, 01-53 based on year
  13. datepart-fullyear = [date-century] date-year ["-"]
  14. datepart-ptyear = "-" [date-subdecade ["-"]]
  15. datepart-wkyear = datepart-ptyear / datepart-fullyear
  16. dateopt-century = "-" / date-century
  17. dateopt-fullyear = "-" / datepart-fullyear
  18. dateopt-year = "-" / (date-year ["-"])
  19. dateopt-month = "-" / (date-month ["-"])
  20. dateopt-week = "-" / (date-week ["-"])
  21. datespec-full = datepart-fullyear date-month ["-"] date-mday
  22. datespec-year = date-century / dateopt-century date-year
  23. datespec-month = "-" dateopt-year date-month [["-"] date-mday]
  24. datespec-mday = "--" dateopt-month date-mday
  25. datespec-week = datepart-wkyear "W"
  26. (date-week / dateopt-week date-wday)
  27. datespec-wday = "---" date-wday
  28. datespec-yday = dateopt-fullyear date-yday
  29. date = datespec-full / datespec-year
  30. / datespec-month /
  31. datespec-mday / datespec-week / datespec-wday / datespec-yday
  32. ; Times
  33. time-hour = 2DIGIT ; 00-24
  34. time-minute = 2DIGIT ; 00-59
  35. time-second = 2DIGIT ; 00-58, 00-59, 00-60 based on
  36. ; leap-second rules
  37. time-fraction = ("," / ".") 1*DIGIT
  38. time-numoffset = ("+" / "-") time-hour [[":"] time-minute]
  39. time-zone = "Z" / time-numoffset
  40. timeopt-hour = "-" / (time-hour [":"])
  41. timeopt-minute = "-" / (time-minute [":"])
  42. timespec-hour = time-hour [[":"] time-minute [[":"] time-second]]
  43. timespec-minute = timeopt-hour time-minute [[":"] time-second]
  44. timespec-second = "-" timeopt-minute time-second
  45. timespec-base = timespec-hour / timespec-minute / timespec-second
  46. time = timespec-base [time-fraction] [time-zone]
  47. iso-date-time = date "T" time
  48. ; Durations
  49. dur-second = 1*DIGIT "S"
  50. dur-minute = 1*DIGIT "M" [dur-second]
  51. dur-hour = 1*DIGIT "H" [dur-minute]
  52. dur-time = "T" (dur-hour / dur-minute / dur-second)
  53. dur-day = 1*DIGIT "D"
  54. dur-week = 1*DIGIT "W"
  55. dur-month = 1*DIGIT "M" [dur-day]
  56. dur-year = 1*DIGIT "Y" [dur-month]
  57. dur-date = (dur-day / dur-month / dur-year) [dur-time]
  58. duration = "P" (dur-date / dur-time / dur-week)
  59. ; Periods
  60. period-explicit = iso-date-time "/" iso-date-time
  61. period-start = iso-date-time "/" duration
  62. period-end = duration "/" iso-date-time
  63. period = period-explicit / period-start / period-end