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

小程序 文章 2022-04-20 09:20 550 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群

相关文章
小程序开发 | 一排item,点击哪个那个item中的文字就变色,点击其他的就其他的变色?
企业微信,第三方应用接口 获取第三方应用凭证,返回47001?
如何使用h5唤起小程序
请问PC端现在可以使用wx.chooseMessageFile上传文件吗?
security.msgSecCheck报错?
随便看看
微信小程序开发? 551
ios使用redirectTo跳转报错? 818
为什么我们有完整的资质?关闭我们支付,商户号1600688764 667
textarea 在iOS真机上有默认高度38px 654
我的商户二维码恶意举报导致无法收款,怎么解决? 1591
完全程序小白,注册完小程序之后怎么弄呢? 647
剪贴板 wx.setClipboardData 复制成功后 toast 能隐藏吗? 1150
请问这问题该如何解决? 545
体验版小程序点击浮窗后,微信秒退,之后无法进入,只能卸载重新安装 952
2.12.1基础库样式继承问题? 666