SECSDIFF(A,B)
  • 1 Minute to read
  • Dark
    Light
  • PDF

SECSDIFF(A,B)

  • Dark
    Light
  • PDF

Article summary

DateTime Transform: SECSDIFF(A,B)

Returns difference in seconds between Time for DateTime A and Time for DateTime B

SECSDIFF(A,B) = AbsoluteSeconds(B) - AbsoluteSeconds(A)

Where

AbsoluteSeconds(B) = number of seconds from date reference (where date reference = Jan 0, 0000) to B

AbsoluteSeconds(A) = number of seconds from date reference (where date reference = Jan 0, 0000) to A


Purpose

Use this function to:
  • Calculate time between events down to the second
  • Calculate the age of an event in seconds

Return Value

PropertyValue
FieldTypeInteger
FieldSizeMed / High / Continuous
DataTypeDiscrete / Continuous
DataSizeInteger


Example Return Value: -N....N   where N = Max(AbsoluteSeconds(B) - AbsoluteSeconds(A))

Parameters

ParameterJSONDescription
Table“targetTable”: “MyTableName”The target table on which the new field will be created
Filter“dataset”: {DataSet_JSON}Optional.   If a filter is applied, records not in the filter Recordset will be returned as null.
DateTime Function“p1”: “SECSDIFF(A,B)”SECSDIFF(A,B)
A“p2”: “DateTimeFieldName”
“p2”: “#YYYY-MM-DD HH:MM:SS”
Required.  DateTime A
Supports:  
  • DataType: Discrete / Continuous
  • Field Type:  DateTime
  • Fixed Value:  #YYYY-MM-DD HH:MM:SS,    e.g. #2021-04-05 11:01:08
B“p3”: “DateTimeFieldName”
“p3”: “#YYYY-MM-DD HH:MM:SS”
Required.  DateTime B
Supports:  
  • DataType: Discrete / Continuous
  • Field Type:  DateTime

  • Fixed Value:  #YYYY-MM-DD HH:MM:SS,    e.g. #2021-04-05 11:01:08

JSON Sample

Usage Notes

Any combination of Field/Immediate value is valid for A and B

e.g.,

FieldA/#2019-01-02 00:00:00

#2020-01-02 00:00:00/#2019-01-02 00:00:00

FieldA/FieldB

#2020-01-02 00:00:00/FieldB

See Also:

  • HOURSDIFF(A,B)  (DateTime)
  • MINSDIFF(A.B)    (DateTime)
  • Engineering | Expression Field

Example

ExampleDetails
DescriptionCalculate the number of seconds between purchase and shipping
Input
  • Table: = [transactions]
  • Function: = DateTimeTransform
  • DateTimeFunction: = SECSDIFF(A,B)
  • A:= [transactions].[dtPurchase]
  • B: = [transactions].[dtShipping] 
  • Name: =SECSDIFF_AB
Sample



Was this article helpful?

What's Next