The purpose of AutoTag's DATE function is to allow a user to return a fully typed date when a specified year, month and day are entered into the function.
For example, if you have values in your data source for a data element that needs to appear in a fully formatted date, then passing (specifying) the year, month and day would allow you to generate a date formatted in your region's desired settings. This also allows you to change the output date format at any time using the AutoTag 'format' button.
There are times that you may also need to execute date calculations in order to apply offsets to a day, month or year. Usage of the DATE function allows you to convert your data source's day, month and year to a date object that the DATESPAN function can easily work with to add offsets to days, months or years.
Where do I Use This Function?
- This function can be used any tag that can execute a select statement
- The most common tags where the DATE function is used are Out, Set, If, Query and ForEach tags.
- Using the Windward tag 'format' attribute to output the date in a specific or region specific format. (For example: mm/dd/yyyy or dd/mm/yyyy). If you are familiar with Excel then the Word 'format' attribute should look very familiar. The formatting is translated from the Java library SimpleDateFormat which gives many examples of formats that can be used.
- Converting data of day, month and year to a DATE object in order to add date offsets (you want to offset a date by a number of years, months, and/or days) with the DATESPAN function
Image 1 - DATE Function in Equation Editor
For example, a data source item that can return a specific year, month and day as individual values would allow you to apply formatting to print the date many different formats.
returns January 2, 2016 when formatted as 'MMMM d, yyyy'.
You can make use of the NOW function to get the current time at the time the report is run
returns the current time stamp at the time of writing this article June 3, 2016.
Adding Date Offsets
Used in conjunction with the DATESPAN function, it would allow you to add 90 days to a date to print the future calculated date.
=NOW() + DATESPAN(0,0,90)
returns, at the time if writing this article (June 3, 2016), September 1st, 2016.
All data sources are supported
Examples in the attached template Date Function Sample - Template.docx
year - Required. The year for the specific date.
- month - Required. The month for the specific date.
- day - Required. The day for the specific date.