Increase or decrease the hour of the acquired time and adjust the time difference

This section describes a process that adds or subtracts the time difference and outputs the Universal Time Coordinated (UTC) time as Japan Standard Time (JST).

This process outputs results such as the following:

Example: when the time difference is nine hours

If the obtained UTC is "2021-06-01T06:04:36.9060502Z", the output date and time becomes "2021-06-01T15:04:36.9060502Z".

Description of the processing

The hour of the acquired Universal Time Coordinated (UTC) is increased or decreased and the results are output.

The following example shows how to create a mapping definition for outputting UTC as JST.

Key features

Current date/time (UTC)

This logic outputs the current date and time.

It can be set from Date > Basic > Current date/time (UTC) of the tool palette.

Numeric constant (integer)

This logic outputs a numeric constant (integer).

It can be set from Number > Basic > Numeric constant (integer) of the tool palette.

Increases or decreases hour

This logic increases or decreases the hour of the input date and time and returns the date and time value.

It can be set from Date > Calculation > Increases or decreases hour of the tool palette.

Operation procedure

This section describes an example on how to output JST by adding nine hours to the obtained UTC.

1. Create a script.

For information about how to create a script, refer to First Step Guide.

The descriptions in this procedure are based on the following scripts:

2. On the script canvas, double-click mapping_1.

The Mapper editor is displayed.

3. Drag and drop the following logics from the tool palette onto the Mapper editor:

  • Date > Basic > Current date/time (UTC) (to obtain the current date and time)

  • Number > Basic > Numeric constant (integer) (to specify the time difference)

  • Date > Calculate > Increases or decreases hour (to increase or decrease hours of the above logic from the current time)

The logics are placed on the Mapper editor.

4. Enter the property of the placed logic.

  1. Double-click the Numeric constant (integer) logic.

    The Numeric constant (integer) Logic Property dialog box is displayed.

  2. Enter a time difference of "9" for Number (integer).

  3. If necessary, also enter a comment in Comment and click Finish.

  4. If necessary, double-click the Current date/time (UTC) logic and Increases or decreases hour logic, enter a comment in Comment, and click Finish.

    • For the Current date/time (UTC) Logic Property dialog box

    • For the Increases or decreases hour Logic Property dialog box

5. Drag and drop the Current date/time (UTC) logic onto the Increases or decreases hour logic.

The mapping link from the Current date/time (UTC) logic to the Increases or decreases hour logic is displayed.

6. Drag and drop the Numeric constant (integer) logic onto the Increases or decreases hour logic.

The mapping link from the Numeric constant (integer) logic to the Increases or decreases hour logic is displayed.

7. Drag and drop the Increases or decreases hour logic onto the output destination.

The mapping link to the output destination from the Increases or decreases hour logic is displayed.

8. Save the script.

For information about how to save a script, refer to First Step Guide.

 

The following result is obtained if you execute the script: