AMAZON.DURATION - Amazon Lex V1

If you are using Amazon Lex V2, refer to the Amazon Lex V2 guide instead.

 

If you are using Amazon Lex V1, we recommend upgrading your bots to Amazon Lex V2. We are no longer adding new features to V1 and strongly recommend using V2 for all new bots.

AMAZON.DURATION

Converts words that indicate durations into a numeric duration.

The duration is resolved to a format based on the ISO-8601 duration format, PnYnMnWnDTnHnMnS. The P indicates that this is a duration, the n is a numeric value, and the capital letter following the n is the specific date or time element. For example, P3D means 3 days. A T is used to indicate that the remaining values represent time elements rather than date elements.

Examples:

  • "ten minutes": PT10M

  • "five hours": PT5H

  • "three days": P3D

  • "forty five seconds": PT45S

  • "eight weeks": P8W

  • "seven years": P7Y

  • "five hours ten minutes": PT5H10M

  • "two years three hours ten minutes": P2YT3H10M