Skip to main content
Version: Python


Periods are a special type of string used to represent a period of calendar time (i.e. days, weeks, months, years, etc.).



  • [-] - An optional sign to indicate that the period is negative. Omitting this makes the period positive.
  • P - The prefix indicating this is a period string.
  • n - An integer value
  • Y - Years
  • M - Months
  • W - Weeks
  • D - Days

Each #[Y|M|W|D] value translates to a part of the time period. A valid period string can contain nearly any combination of these values. For example, P1M1D (1 month and 1 day), P1Y3M (1 year and 3 months), and P3W2D (3 weeks and 2 days) are all valid period strings.