Topic: DMD0035

Help File Version: 2.10.0.636

DTCMP - Compare Date / Time


The Compare Date / Time (DTCMP) instruction compares the Date and / or Time fields of two Date / Time structures. The comparison operation subtracts the second date / time from the first date / time.

 

 

Note: use the Copy Memory Range (MEMCOPY) instruction to copy from one Data / Time structure to another.

 

Note: to compare fields of a Date / Time structure other than the complete Date and Time, for example only the Year, or Seconds, use relational contacts referencing those specific fields (<structure>.Year, <structure>.Seconds, etc.).

 


Parameters:

Note: Use the F9 key or click the 'three dot box' at the right edge of the parameter field to open the Default Element Selection Tool (the Element Picker or the Element Browser) or use the Down-Arrow key (Auto-Complete) on any parameter field to see a complete list of the memory locations that are valid for that parameter of the instruction.

 

First Date / Time - specifies a Date / Time structure. This can be any of the system-defined Date / Time structures, or any user-defined Date / Time structure.

 

Second Date / Time - specifies a Date / Time structure to compare to the First Date / Time. This can be any of the system-defined Date / Time structures, or any user-defined Date / Time structure.

 


Compare - selects which fields in the Date / Time structures to compare

 

  • Compare Date and Time - compares both the Date field and the Time field of the two structures
     

  • Compare Date Only - compares only the Date field of the two structures.
     

  • Compare Time Only - compares only the Time field of the two structures.

 


Set if First Equals Second - specifies a bit location to turn ON if the comparison is equal, otherwise it turns it OFF. This can be any writable bit location.

 

Set if First is Before Second - specifies a bit location to turn ON if the First Date / Time is before (less than) the Second Date / Time, otherwise it turns it OFF. This can be any writable bit location.

 

Set if First is After Second - specifies a bit location to turn ON if First Date / Time is after (greater than) the Second Date / Time, otherwise it turns it OFF). This can be any writable bit location.

 


Status Display:

 

The status display shows fully-qualified values for both Date / Time structures.

 


See Also:

DT2EPOCH - Convert Date / Time to 1970 Epoch

 

EPOCH2DT - Convert 1970 Epoch Time to Date / Time

 

DTCMP - Compare Date / Time

 

DTDIFF - Difference between two Date / Times

 

DTOFFSET - Add Offset to Date / Time

 


Related Topics:

Date and Time Overview

 

Predefined Date / Time Structures

 

Date / Time Structure Fields

 

NETTIME - SNTP Client

 

SETTIME - Set PLC Date / Time

 


Rung Example: