关于云函数上时间戳换日期的问题。手机跟电脑测试居然不一致?

小程序 文章 2022-04-20 09:20 573 0 全屏看文

AI助手支持GPT4.0

关于云函数上时间戳换日期的问题。手机跟电脑测试居然不一致?Regarding the issue of changing timestamps to dates on cloud functions. Is the test on the mobile phone and the computer actually inconsistent?

关于云函数上时间戳换日期的问题。手机跟电脑测试居然不一致?

问题是这样的,同一个云函数,手机上调用,跟电脑上调用,返回的日期居然相差一天。

直接上图,各位看看是怎么回事。。。。

这个是代码

这个是电脑上调用结果

1650394920461

这个是手机测试 日志结果

1650394552861

我希望有大佬可以给我解惑,看是我什么地方理解错了。。。

The problem is that the return date of the same cloud function called on the mobile phone is one day different from that called on the computer. Go straight to the above picture and see what's going on.... This is the code, this is the result of the call on the computer 1650394920461, this is the result of the mobile phone test log 1650394552861, I hope someone can solve my doubts and see what I misunderstood...

回答:

Mr.Zhao:

时区不一样

brave:

云函数中的时区为 UTC+0,不是 UTC+8,在云函数中使用时间时需特别注意。如果需要默认 UTC+8,可以配置函数的环境变量,设置 TZ 为 Asia/Shanghai



天天开心:

配置时区

文档搜TZ


-EOF-

AI助手支持GPT4.0


国内超级便宜服务器

摸鱼人热门新闻聚合

钻级赞助商 我要加入

开发者在线工具

第三方支付技术请加QQ群

相关文章
微信小程序如何实现分享到朋友圈功能?
我修改公众号名称时显示该名称与已有小程序名称重复,需与该小程序帐号相同主体才可申请?
微信扫码登录在IE9以下跑有报错
image加载不出来图片,这是什么问题?
人脸核身接口,系统暂不可用?
随便看看
微信开放平台跟公众平台有什么区别? 3608
怎么添加小程序支付功能? 4516
教育科技公司申请微信支付被拒绝? 4798
微信公众号免300认证教程 5892
小程序已经上线,作为管理员无法在小程序数据助手查看数据? 5299
小程序广告组件通过审核,但是小程序内没有显示广告? 5067
企业微信通讯录账号被管理员误/恶意删除,怎么办? 9568
问题? 9048
如何快速搭建抽奖助手小程序(无需代码知识) 6177
许涛 大哥在吗, 要解冻小程序的时候提示信息主体不一致, 能帮忙看下吗? 7472