Editar

Partilhar via


datetime_utc_to_local()

Applies to: ✅ Microsoft FabricAzure Data ExplorerAzure MonitorMicrosoft Sentinel

Converts UTC datetime to local datetime using a time-zone specification.

Syntax

datetime_utc_to_local(from,timezone)

Learn more about syntax conventions.

Parameters

Name Type Required Description
from datetime ✔️ The UTC datetime to convert.
timezone string ✔️ The timezone to convert to. This value must be one of the supported timezones.

Returns

A local datetime in the timezone that corresponds the UTC datetime.

Example

print dt=now()
| extend pacific_dt = datetime_utc_to_local(dt, 'US/Pacific'), canberra_dt = datetime_utc_to_local(dt, 'Australia/Canberra')
| extend diff = pacific_dt - canberra_dt

Output

dt pacific_dt canberra_dt diff
2022-07-11 22:18:48.4678620 2022-07-11 15:18:48.4678620 2022-07-12 08:18:48.4678620 -17:00:00