Products Downloads


French version


 

This function compares two Date or Time or Date-time type values. Returns 0 if the two temporal values are equal.

It returns a value lower than 0 if the first value is strictly lower than (before) the second.

It returns a value higher than 0 if the first value is higher than (after) the second.

Two values of the following types can be compared:

  • Date and Date,
  • Time and Time,
  • Date-time and Date-time,
  • Date and Date-time,
  • Time and Date-time.

The Time/Date comparison does not make sense.

 

Parameters

Date/Time/Date-time

temporalVal1

Temporal value

Mandatory

Date/Time/Date-time

temporalVal2

Temporal value

Mandatory

 


For example

<#assign temporalVal1 = .now />
<#assign temporalVal2 = "1995-07-18"?date.xs />
<#assign compare = hardisCore.compareDateTime(temporalVal1, temporalVal2) />
<#if compare == 0>
${temporalVal1} equals ${temporalVal2}
<#elseif compare > 0>
${temporalVal1} is greater than ${temporalVal2}
<#else>
${temporalVal1} is less than ${temporalVal2}
</#if>

↑ Top of page