Get Asterisk server time zone via AMI

The timestamps in AMI events are in UTC. Is it possible to get the server local time(zone) through the AMI only? Not adding anything to a dialplan. Asterisk 11.

Try to get the value of STRFTIME(), if you don’t provide arguments, it’s supposed to use the timezone from the system and give the current time in this timezone.

STRFTIME([<epoch>][,[<timezone>][,<format>]])

Formats the time specified by epoch, localized to timezone. The format comes directly from the underlying C function strftime(3). If epoch is not specified, defaults to the current time. Timezone likewise defaults to the timezone on the host computer.

Source: Asterisk func strftime - VoIP-Info

In my system (Asterisk 18) I get:

Action: GetVar
Variable: STRFTIME()

Response: Success
Variable: STRFTIME()
Value: Mon Aug 23 17:32:28 2021
1 Like

Perfect! Thank you so much.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.