Skip to main content
Skip table of contents

Create a Time Span Field

A time span field is a measure that calculates the time difference between two date/time fields (or a date/time field and a specified date).

To create a time span field:

  1. Select Cross > Define Field. The Define Fields window displays.
  2. Click Time Span. The Time Span Field window displays.
  3. Enter the following details:

    FieldDescription
    Field NameEnter a name for the field.
    Number ofSelect whether to measure the time difference in daysmonths or years.
    Between

    Select the start and end points of the time span.

    • Only date/time type fields will be available for selection.
    • For the end point, instead of selecting a field you can optionally specify a fixed date.
  4. Click OK.

Note About Time Calculations

By default, SuperSTAR uses an estimated method for calculating the difference between dates.

If you request that the difference between two dates is specified in years then the value is calculated by dividing by 365.25 (i.e. the effect of leap years is averaged out). This can result in inaccuracies if you calculate a range UDF on top of a time span UDF for dates that are on exact year boundaries. In this case the computed value will be slightly greater, or slightly less than the integer multiple of years depending on how many leap days fall into the range.

For example, if you calculate the days between 1/1/2001 and 1/1/2002 then SuperCROSS returns 365 / 365.25 = 0.9993, whereas a user (and the range UDF) would expect the result to be exactly 1 year.

As an alternative, SuperCROSS can use a different time calculation: discrete time calculation. When this mode is active, SuperCROSS computes, in addition to the total number of days, the integer value of the number of whole years, whole months and remaining days. Instead of averaging from the total number of days, it uses the following calculations:

CODE
datespan in years = nYears + (nMonths / 12) + (nDays / 365.25)
datespan in months = nYears*12 + nMonths + (nDays / (365.25/12))

In the example above, this calculation results in the expected whole number result for a full year.

To enable the calculation you need to create the following environment variable and set it to true:

CODE
STR_DS_DISCRETE_TIME_SPAN=true
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.