4.13.36 Obtain date and time
Function
This plug-in acquires the current time on the execution target server according to the specified format.
This plug-in stores the acquired date and time in the acquisition results (the common.getResult property).
Optionally, you can specify the time zone for the dates and times to be output.
The following is an explanation of the format (the common.dateAndTimeFormat property):
- Specify a string of 64 or fewer characters.
- The conversion specifier characters in the character string specified for the format (the common.dateAndTimeFormat property) is converted into corresponding values.
However, character strings other than conversion specifier characters are stored in the acquisition results (property common.getResult) without being converted.
Examples of conversion specifier characters are listed below.
[Conversion specifier characters]
%Y: 4-digit western calendar year including century
%y: Last 2 digits of a western calendar year, excluding the century. Pad 0 before a single-digit year.
%m: Month. Pad 0 before a single-digit month.
%d: Date. Pad 0 before a single-digit date.
%H: Hour in 24-hour notation. Pad 0 before a single-digit hour.
%I: Hour in 12-hour notation. Pad 0 before a single-digit hour.
%M: Minute. Pad 0 before a single-digit minute.
%S: Second. Pad 0 before a single-digit second.
%s: Seconds that have passed since 1970-01-01 00:00:00 UTC
The following is an explanation of the time zone (the OS.timeZone property):
- If specification of the time zone (the OS.timeZone property) is omitted, this plug-in acquires the current time in the time zone that is specified for the user that is connected to the execution target server by using agentless connection.
- For the Windows execution-target server, specify a time-zone ID that can be confirmed by using the TZUTIL command with the /l option specified.
Example specifications are:
Tokyo Standard Time
China Standard Time
GMT Standard Time
Pacific Standard Time
Eastern Standard Time
US Eastern Standard Time
Central Standard Time
Central America Standard Time
US Mountain Standard Time
Mountain Standard Time
Alaskan Standard Time
Hawaiian Standard Time
Singapore Standard Time
India Standard Time
- For the Linux execution-target server, specify a time zone file name that is in the /usr/share/zoneinfo directory.
Example specifications are:
America/Adak
America/Boise
America/Chicago
America/Denver
America/Detroit
America/Juneau
America/Kentucky/Monticello
America/Los_Angeles
America/Louisville
America/Monterrey
America/Montevideo
America/New_York
America/North_Dakota/Center
America/Shiprock
America/Tijuana
America/Vancouver
Asia/Chongqing
Asia/Hong_Kong
Asia/Kolkata
Asia/Macau
Asia/Shanghai
Asia/Singapore
Asia/Tokyo
Etc/UTC
Europe/London
Pacific/Honolulu
- For the AIX execution-target server, specify a time zone file name that is in the /usr/share/lib/zoneinfo directory.
For an example of how to specify this plug-in, see the description for when the OS of the execution-target server is Linux.
The following is an explanation of the acquisition results (the common.getResult property):
- This plug-in acquires the current time of the execution target server according to the format (the common.dateAndTimeFormat property).
- For the Windows execution-target server, this plug-in stores results of the Get-Date commandlet of PowerShell (the -UFormat option).
- For the UNIX execution-target server, this plug-in stores results of the date command.
Use situation
You can use this plug-in to use the current time by converting it into a particular format.
Prerequisites
For the most recent information about the prerequisite products for the system, prerequisite products for the execution-target server, and the supported OSs for the execution-target server, see the release notes.
[Prerequisite products for the system]
JP1/Automatic Operation 11-00 or later
[Prerequisite products for the execution-target server]
None.
[Supported OSs for the execution-target server]
(1) Windows Server 2008 R2 Standard/Enterprise/Datacenter
(2) Windows Server 2012 Standard/Datacenter, Windows Server 2012 R2 Standard/Datacenter
(3) Windows Server 2016 Standard/Datacenter
(4) Red Hat Enterprise Linux Server 6 (32-bit x86), Red Hat Enterprise Linux Server 6 (64-bit x86_64)
(5) Red Hat Enterprise Linux Server 7 (64-bit x86_64)
(6) CentOS 6 (64-bit x86_64)
(7) CentOS 7 (64-bit x86_64)
(8) AIX V6.1, AIX V7.1
[Conditions for using the execution-target server]
(1) For the Windows execution-target server, Microsoft .Net Framework 3.5 or later must be installed to specify the time zone (the OS.timeZone property).
Cautions
(1) Do not specify character strings containing double quotation marks (") or single quotation marks (') for properties of this plug-in.
(2) You can use conversion specifier characters other than those listed in the functional description. For the Windows execution-target server, see the manual for the Get-Date commandlet of PowerShell (the -UFormat option). For the UNIX execution-target server, see the manual for the date command. However, do not specify conversion specifier characters such as %n or %t that are converted into control characters
(3) For the Windows execution-target server, do not use curly brackets ({ or }) for the format (the common.dateAndTimeFormat property). If curly brackets are specified, this plug-in ends abnormally.
(4) For the UNIX execution-target server, when a time zone that is not defined on the OS is specified for the time zone (the OS.timeZone property), the time zone UTC is used. For the Linux server, make sure that the specified time zone is contained in the directory /usr/share/zoneinfo. For the AIX server, make sure that the specified time zone is contained in the directory /usr/share/lib/zoneinfo.
(5) Specify "%%" for the format (the common.dateAndTimeFormat property) to output "%" to the acquisition results (the common.getResult property)
(6) The value to be stored in the acquisition results (the common.getResult property) is not the execution start time of this plug-in. For the Window execution-target server, the time when the Get-Date commandlet of PowerShell was executed is stored. For the UNIX execution-target server, the time when the date command was executed is stored.
Version
02.02.00
Plug-in tags
Gather OS information,Windows,Linux,AIX
Plug-in name displayed in the task log
osGetDateAndTime
Return code
0: Normal
12: Error (mistake by the user): A property is invalid.
27: Error (Check the details on the error in the task log.)
41: Error (An error was detected in the component.): A property was not entered. (An error was 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.dateAndTimeFormat |
Format |
Specify the format used to convert the current date and time. |
%Y-%m-%dT%H:%M |
Input |
R |
OS.timeZone |
Time zone |
Specify the time zone. |
-- |
Input |
O |
common.getResult |
Obtained result |
The current date and time obtained in the specified format is stored here. |
-- |
Output |
O |
common.returnValue |
Return value for the plugin |
The return value of this plugin stored. |
-- |
Output |
O |