# Time Conversion

The conversion of time from one time zone to another occurs when sending control commands (with a timestamp), synchronizing time, and receiving information objects with the timestamp CP56Time2a.

The time formation process for control and time synchronization commands is as follows: the current local time is converted to UTC (based on the operating system’s time zone settings), then the UTC time is converted to the time in the time zone specified in the *Device Time Zone* parameter. For example, the operating system’s time zone is Europe / Moscow (UTC +03: 00), the client’s current time is 2019-12-15 19:31:00, and the time zone specified for the device is America / Costa\_Rica (UTC -06: 00). The total time that the command will contain will be generated as follows: 2019-12-15 19:31:00 (Local) → 2019-12-15 16:31:00 (UTC) → 2019-12-15 10:31:00 (Device Time Zone).

The conversion process of the timestamp CP56Time2a of the information object to the timestamp of the tag is as follows: the time of the information object is converted to UTC (based on the device’s time zone settings), then the received UTC time is converted to the time in the time zone of the operating system. For example, the device’s time zone is America / Costa\_Rica (UTC -06: 00), the device’s current time is 2019-12-14 19:15:00, and the time zone of the server is Europe / Moscow (UTC +03: 00). The total time of the tag will be formed as follows: 2019-12-14 19:15:00 (Device Time Zone) → 2019-12-15 01:15:00 (UTC) → 2019-12-15 04:15:00 (Local). If an invalid or ambiguous time occurs during the conversion of CP56Time2a time from one time zone to another, the ASDU will be assigned the timestamp of the tag. You can read more about invalid and ambiguous times [<mark style="color:blue;">here</mark>](https://codeofmatt.com/five-common-daylight-saving-time-antipatterns-of-net-developers/#-4-field-validation).

To ensure cross-platform compatibility, time zone identifiers from the [<mark style="color:blue;">IANA</mark>](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) database are used. Therefore, **if time zone identifier is not found when uploading the configuration, for example, from the test server to the production server, then the local time zone will be used to convert the time**, and an error message will appear in the server’s event log. In order to avoid problems associated with the time conversion from one time zone to another, it is recommended to generate timestamps in the UTC time zone at the controlled station.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.monokot.io/tags-and-devices/iec-60870-5-104-connectivity/time-conversion.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
