Bemærk
Adgang til denne side kræver godkendelse. Du kan prøve at logge på eller ændre mapper.
Adgang til denne side kræver godkendelse. Du kan prøve at ændre mapper.
Switch services using the Version drop-down list. Learn more about navigation.
Applies to: ✅ Microsoft Fabric ✅ Azure Data Explorer ✅ Azure Monitor ✅ Microsoft Sentinel
Converts UTC datetime to local datetime using a time-zone specification.
Syntax
datetime_utc_to_local(from,timezone)
Learn more about syntax conventions.
Note
datetime_utc_to_local() is a built-in Kusto function and does not require importing any additional libraries. If you receive an error that the function does not exist, confirm that you're running the query in a supported environment (Azure Data Explorer, Microsoft Sentinel, Azure Monitor, Microsoft Fabric).
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
Returns a local datetime in the timezone that corresponds the UTC datetime.
Examples
The following example shows how to convert a UTC datetime to local datetime.
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 |
Related content
- To convert a datetime from local to UTC, see datetime_local_to_utc()
- Timezones
- List of supported timezones
- format_datetime()