Date and Interval elements of AIML provide a comprehensive mechanism for viewing and manipulating time-based data ## Date The date tag provides a way to format the current date and time using a variety of ways. The formatting is controlled by the format attribute of the date tag. This is a string which takes a set of formatting options as defined by the Python Programming Language [datetime module](https://docs.python.org/3.6/library/datetime.html) In this first example, we use the date tag to return the name of the day. As defined by the formatting command "%A". ```xml DAY ``` When this is run in the bot, and you ask for the day, it returns the textual representation of the day as follows ```bash Loading, please wait... No bot root argument set, defaulting to [.] Y-Bot version 0.0.1, initiated March 14, 2017 Hi, how can I help you today? >>> DAY Today is Thursday ``` Another way to use the date tag is to set the value of a variable and then act on the value of the variable. In the next example, we use the name of the month to return the name of the season ```xml SEASON ``` Running this through the bot we can ask for the name of the season as follows ```bash Loading, please wait... No bot root argument set, defaulting to [.] Y-Bot version 0.0.1, initiated March 14, 2017 Hi, how can I help you today? >>> SEASON Winter ``` Some additional useful uses are as follwos ```xml YEAR MONTH TIME DATE DAY PHASE DATE AND TIME ``` ## Interval Interval tag allows you to compute the time difference between 2 periods and then obtain the difference in a variety of formats, in the same way, that the date tag works. ```xml DAYS UNTIL CHRISTMAS ``` We now have an incredibly useful grammar for asking the number of days until Christmas ```bash Loading, please wait... No bot root argument set, defaulting to [.] Y-Bot version 0.0.1, initiated March 14, 2017 Hi, how can I help you today? >>> Days until christmas 46 days until Christmas. ``` Or a more generic one ```xml DAYS UNTIL month number number ``` Running this in the bot and we can ask for the number of days between now and a future date ```bash Loading, please wait... No bot root argument set, defaulting to [.] Y-Bot version 0.0.1, initiated March 14, 2017 Hi, how can I help you today? >>> Days until December 24 2017 45 days. ``` For a more detailed description of how to use all the various formatting options see the Python Programming Language [datetime module](https://docs.python.org/3.6/library/datetime.html) *** [Back to Tutorial](./AIML-Tutorial) | [Back - Conditions](./Tutorial-Conditions) | [Next - System Information](./Tutorial-System-Information)