简体   繁体   English

Azure 函数 (Python) - 为计时器触发器设置时区

[英]Azure Function (Python) - Set Timezone For Timer Trigger

ISSUE问题

I am trying to setup my UTC CRON job in my Azure Function App to run based on EST/EDT timezone.我正在尝试在我的 Azure Function App 中设置我的 UTC CRON 作业以基于 EST/EDT 时区运行。

My thought is that you enter in your CRON time for your desired timezone, and then via the Azure portal set the configuration option WEBSITE_TIME_ZONE to America/New_York (see image that shows Azure Function is running Linux and not Windows).我的想法是您输入所需时区的 CRON 时间,然后通过 Azure 门户将配置选项WEBSITE_TIME_ZONE设置为America/New_York (请参见显示 Azure Function 运行的是 Linux 而不是 Windows 的图像)。

在此处输入图像描述 在此处输入图像描述

MORE INFO更多信息

According to the below, 08:30 UTC should be 04:30 EDT currently.根据下面的说法,08:30 UTC 目前应该是 04:30 EDT。 So that is when I am expecting the monitor to run.所以这就是我期待监视器运行的时候。 It is still running via the CRON job at 08:30 UTC instead of 08:30 Eastern time (04:30 EDT).它仍在 UTC 08:30 而不是东部时间 08:30(美国东部时间 04:30)通过 CRON 作业运行。

https://www.freeconvert.com/time/utc-to-est https://www.freeconvert.com/time/utc-to-est

在此处输入图像描述

Using Python使用 Python 在此处输入图像描述

According to Microsoft-Documentation it says,根据微软文档,它说,

In configuration add app settings WEBSITE_TIME_ZONE and set value to America/New_York在配置中添加应用设置 WEBSITE_TIME_ZONE 并将值设置为 America/New_York

在此处输入图像描述

Then save it然后保存

在此处输入图像描述

WEBSITE_TIME_ZONE is not currently supported on the Linux Consumption plan. Linux 消费计划目前不支持WEBSITE_TIME_ZONE

Output:输出:

You get the desired output in Desired Time Zone您在 Desired Time Zone 中获得所需的输出

在此处输入图像描述

Taken References from:引用自:

As per July 2022, this is not supported for Linux Function App running on a consumption plan (see documentation ):根据 2022 年 7 月,在消费计划上运行的 Linux Function App 不支持此功能(请参阅文档):

WEBSITE_TIME_ZONE is not currently supported on the Linux Consumption plan. Linux 消费计划目前不支持WEBSITE_TIME_ZONE

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM