You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何为云函数定时任务配置沙特阿拉伯利雅得时区

配置Google Cloud定时云函数为沙特阿拉伯利雅得时区

你需要使用**Asia/Riyadh**作为时区参数,IANA时区数据库中并没有Saudi_Arabia/Riyadh这个合法条目,正确的时区命名格式遵循「大洲/城市」规则。

修改后的代码如下:

exports.scheduledFunctionCrontab = functions.pubsub.schedule('5 11 * * *')
  .timeZone('Asia/Riyadh') 
  .onRun((context) => {
    // 你的函数逻辑
  });

如果需要验证其他合法时区,可通过以下方式查询:

  • Linux/macOS系统:执行命令 timedatectl list-timezones 或 tzselect
  • Windows系统:执行命令 tzutil /l

内容的提问来源于stack exchange,提问作者deem

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.24 01:57:02