DATEDIFF Function - Documentation for BMC AMI DevX Data Studio Help
Emma Powell Function Type
Predefined function
Syntax
DATEDIFF( <interval>, <dateValue1>, <dateValue2> )
Description
Determines the number of time intervals between two dates.
Argument
Description
<interval>
String describing "part" of the time interval used to calculate the difference between two date arguments. Shown below is a list of valid time interval parts:
Time Parts
Interval Value
Year
y
Quarter
q
Month
M
Day of Year
D
Day of Month
d
Weekday
E
Week
w
Hour in am/pm (1-12)
h
Hour in day (0-23)
H
Minute
m
Second
s
The intervals for Day of Year ("D"), Day of Month ("d"), and Weekday ("E") can be used interchangeably to determine the difference between the two dates in days.
<dateValue1>
Date type representing the first date to be used in the difference calculation.
<dateValue2>
Date type representing the second date to be used in the difference calculation.
Returns
Integer. DATEDIFF returns a negative integer if the first date parameter is more recent than the second date parameter. If the second date is more recent, it returns a positive integer.
Example
This example writes the difference between dates in the source fields, Field1 and Field2 (in number of days).
DATEDIFF("d",Source.Table1.Field1,Source.Table1.Field2)