0

Date Difference

  • updated 1 yr ago

Description

When using this part, the system returns the difference between two date-time variables, in a group (user-defined) that holds the difference in terms of seconds, minutes, hours, days, months and years.

Use

This part allows users to assess how much time has passed between two events, or between a previous/future date and today (using now() as one of the date inputs). The output collection contains the difference in values in various time units of measure, as well as a flag to show whether the difference is positive or negative (whether the second input date is after or before the first).

Editor Fields

Field Name

Description/Use

Type/Options 

Optional/
Mandatory 

Group

This field contains the group name within which the system stores the results. 

Container Name

Mandatory

Input type

This field allows the user to specify whether the date inputs are standard (YYMMDD.HHMMSS or Epoch dates

Standard | Epoch

Mandatory

Date 1

This is the data object used as the start date in the calculation of difference.

Data Object*

Optional **

Date 2

This is the data object used as the end date in the calculation of difference.

Data Object*

Optional **

Mode

This is the "resolution" of the calculation and can be set to date or date and time

date | datetime

Mandatory

Part Editor Notes:
* Date inputs require the user to enter the $() data object construction.
** If left blank the input is assumed to be now (current date and time)

Mode

Choosing the mode calculate date difference will ignore any timestamps included  in the dates, and the output will not include hours or minutes except totals.

Output

The date difference is output as objects in a group using the following naming conventions

  • years, months, days, hours, minutes, seconds all calculate the time-unit-specific whole number difference of  between that time unit in each date  e.g.

    the hours difference of January 1st 9pm and January 3rd 9am is 12; 
    the days difference is 1 (1 day to Jan 2nd pm, then a partial day to Jan 3rd am)
     
  • total_years, total_months, total_days, total_hours all calculate the total number of time units between the dates

    the total_hours difference of January 1st 9pm and January 3rd 9am is 36 (24 + 12)
    the total_days difference is 1 (only 1 whole day between the dates)
     
  • counted_years, counted_months, counted, days all calculate the total number of time units between the dates, but rounded up in case of fractional periods.

    the counted hours difference is 36 (no rounding required
    the counted_days difference is 2 (the 1st to the 3rd is 2 days, rounding up for the partial day

Example

Using input dates of July 1st 2016 and April 28 2017 and defining the group as "diff" gives the following results in the context. Calculations are done for total difference and unit difference for seconds, minutes, hours, days, months and years.
 


if Date 1 is later than Date 2 additional value of 1 is assigned to diff.negative in same way, to indicate reversal of dates. Results for same dates above in reverse are:
Reply Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
Like Follow
  • 1 yr agoLast active
  • 56Views
  • 3 Following

Home