4.13.39 Comparing dates and times
Function
This plug-in compares two time values.
It compares the standard time (common.standardDate property) and the target time (common.compareDate property). If the target time is later than the standard time, the plug-in returns "true". If the target time is earlier than the standard time, the plug-in returns "false". After comparison, the later time is stored in the common.newResultDate property, and the earlier time is stored in the common.oldResultDate property.
The smallest unit of time that can be used for comparison is seconds.
Notes on values to be specified for the common.standardDate and common.compareDate properties:
- Specify the values in "yyyy/mm/dd hh:MM:ss" format.
- If you omit the time, the default time 00:00:00 is set. If you omit the date, the date on which the plug-in is executed on the execution-target server is set.
Notes on the comparison result that is output to the common.compareResult property:
- If the compared time values are the same, "true" is returned.
Notes on the times that are output to the common.newResultDate and common.oldResultDate properties:
- The values of the common.standardDate and common.compareDate properties are stored in the common.newResultDate and common.oldResultDate properties, as is.
Use situation
This plug-in can be used to obtain and compare time information from two files, and to determine which file is newer (or older).
Prerequisites
For the most recent information about the prerequisite products in the system, the prerequisite products on the execution-target server, and the supported OSs on the execution-target server, see the Release Notes.
[Prerequisite products in the system]
JP1/Automatic Operation 11-00 or later
[Prerequisite products on the execution-target server]
None.
[Supported OSs on the execution-target server]
(1) Windows Server 2008 R2 Standard/Enterprise/Datacenter
(2) Windows Server 2012 Standard/Datacenter or Windows Server 2012 R2 Standard/Datacenter
(3) Windows Server 2016 Standard/Datacenter
(4) Windows Server 2019 Standard/Datacenter
(5) Red Hat Enterprise Linux Server 6 (32-bit x86) or Red Hat Enterprise Linux Server 6 (64-bit x86_64)
(6) Red Hat Enterprise Linux Server 7 (64-bit x86_64)
(7) Red Hat Enterprise Linux Server 8 (64-bit x86_64)
(8) CentOS 6 (64-bit x86_64)
(9) CentOS 7 (64-bit x86_64)
(10) CentOS 8 (64-bit x86_64)
(11) Oracle Linux 8 (64-bit x86_64)
[Conditions for using the execution-target server]
None.
Cautions
(1) For the properties of this plug-in, do not specify any strings that include double quotation marks (") or single quotation marks (').
(2) The functional description does not cover all supported time formats. Note, however, that there are some formats for which comparison cannot be performed correctly although the plug-in terminates normally. The following describes how to check whether the correct comparison result can be obtained for a time format.
If the OS of the execution-target server is Windows, execute the Get-Date command. If the OS of the execution-target server is UNIX, execute the date command (with the -d option specified). Then, check whether the input time and output time are the same.
The following is an example where the input time and output time are the same (on a UNIX execution-target server):
Input: date -d "2009-06-15 20:45"
Output: Mon Jun 15 20:45:00 JST 2009
The following is an example where the input time and output time are different (on a UNIX execution-target server):
Input: date -d "2015-03-03 T 14:18:27"
Output: Tue Mar 3 16:18:27 JST 2015
Version
02.00.00
Plug-in tags
Gather OS information,Windows,Linux
Plug-in name displayed in the task log
osCompareDateAndTime
Return code
0: Normal
12: Error (Mistake by user) Invalid property
27: Error (Check with the task log about the error detail) Unidentified error
41: Error (An error has been detected in the plug-in) Property not entered (An error has been detected in the component script)
Property list
The following table lists the properties:
Property key |
Property name |
Description |
Default value |
I/O type |
Required |
---|---|---|---|---|---|
plugin.destinationHost |
Host name of the execution target server |
Specify the host name or IP address of the server on which this plugin will be executed. IPv6 addresses are not supported. |
-- |
Input |
R |
common.standardDate |
Reference date and time |
This is the reference date and time used for comparisons. |
-- |
Input |
R |
common.compareDate |
Comparison date and time |
This is the date and time used for comparisons with the reference date and time. |
-- |
Input |
R |
common.compareResult |
Comparison results |
If the comparison date and time is newer than the reference date and time, "true" is returned. If not, "false" is returned. If the comparison date and time is same as the reference date and time, "true" is output. |
-- |
Output |
-- |
common.newResultDate |
Comparison results (new) |
The comparison date and time and the reference date and time are compared, and then the newer date and time are output. |
-- |
Output |
-- |
common.oldResultDate |
Comparison results (old) |
The comparison date and time and the reference date and time are compared, and then the older date and time are output. |
-- |
Output |
-- |
common.returnValue |
Return value for the plugin |
The return value of this plugin stored. |
-- |
Output |
-- |