Skip to main content

Select, As Of Duration

Duration expressions represent periods of time, and in Fluree, we specifically use duration to periods of time before the present. Duration expressions in ISO-8601 duration format. ISO-8601 duration format always begin with a "P". Every increment of time is represented as a capital letter and the amount of that unit is placed before the letter.

Any units of time less than a day are preceded by a "T". A few examples:

  • P60Y: 60 years ago
  • P5YT10M: 5 years and 10 minutes ago
  • PT10H54M: 10 hours and 54 minutes ago
  • P2Y1M20DT5H16M: 2 years, 1 month, 20 days, 5 hours, and 16 minutes ago

There are good resources explaining more about this format.

If we wanted to select 10 actors as of 2 months ago, we could issue:

{
"select": ["*"],
"from": "actor",
"block": "P2M",
"limit": 10
}

Select 2 Movies (`movie`), as of 2 hours and 10 minuntes ago