Menu

Expand
Rate this page:

Twilio.DATE

The Twilio.DATE built-in field enables Autopilot to understand dates expressed by users in different formats and forms. It converts words that describe a date into ISO-8601 date format.

Absolute Dates

Absolute dates are converted from natural language input to the standard date format.

Example input Example Output
December 25th 2018 2018-12-25
October 1st, 2019 2019-10-01
December 24th, 1992 1992-12-24

Relative Dates

Relative dates have the following properties:

  • Future dates are implied by default when missing the year or month.
  • UTC is used as the base time zone.

Below are some examples of relative dates. For the examples, we provide the current input, the current date when the input is evaluated and the example output.

Example input Current Date Example Output Notes
December 25th 10/10/2018 2018-12-25 The year is 2018 because December 25th, 2018 is the next occurrence of such date after the current date (10/10/2018).
October 1st 10/10/2018 2019-10-01 The year is 2019 because October 1st, 2019 is the next occurrence of such date after the current date (10/10/2018).
Today 10/10/2018 2018-10-10 Note that this takes the current date in UTC time.
Thursday 10/10/2018 2018-10-11 Since the current date (10/10/2018) was a Wednesday, the next Thursday would be the day after.
Monday 10/10/2018 2018-10-15 Since the current date (10/10/2018) was a Wednesday, the next Monday would be October 15, 2018.
Yesterday 10/10/2018 2018-10-09 Note that this takes the current date in UTC time.
Tomorrow 10/10/2018 2018-10-11 Note that this takes the current date in UTC time.
Next year 10/10/2018 2018-10-10 Note that this takes the current date in UTC time.

Rate this page:

Need some help?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.

Loading Code Sample...
        
        
        

        Thank you for your feedback!

        Please select the reason(s) for your feedback. The additional information you provide helps us improve our documentation:

        Sending your feedback...
        🎉 Thank you for your feedback!
        Something went wrong. Please try again.

        Thanks for your feedback!

        thanks-feedback-gif