Skip to main content
Windward

DATESPAN Function

Overview

The DATESPAN function represents a time span.

For example,

=DATESPAN(3,2,1)

represents a timespan of 3 years, 2 months, and 1 day.

There is one major use:

  1. Can be added to a date to provide an offset of a given number of years, months, and/or days.  A date can be obtained using the DATE, DATA, and DATEDATA functions.

Syntax

DATE(year,month,day)

  • ​year - Required. The number of years to span.
  • month - Required. The number of months to span.
  • day - Required. The number of days to span.

Video

For step-by-step instructions and a video demonstration, click here.

 

Overview 

The purpose of AutoTag's DATE function is to allow a user to return a fully typed date when a given 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 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.  IE  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

Examples 

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.

Static Date 

1 =DATE(2016,1,2)

 

returns January 2, 2016 when formatted as 'MMMM d, yyyy'.

Dynamic Date 

You can make use of the NOW function to get the current time at the time the report is run

1 =NOW()

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.

 

1 =NOW() + DATESPAN(0,0,90)

 

returns, at the time if writing this article (June 3, 2016), September 1st, 2016.

Data Sources  

All data sources are supported

Examples in the attached template Date Function Sample - Template.docx

Syntax 

DATE(year,month,day)

  • year - Required. The year for the specific date.

  • month - Required. The month for the specific date.
  • day - Required. The day for the specific date.
  • Was this article helpful?