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

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

相关文章
小程序服务器域名的主体需要跟小程序认证主体一致吗?
请问一下微信小程序延时函数如何调用自己定义的函数?
“AppID”、“APPID”、“appid”,那一个才是正确的?怎么读?
page页离奇宽度
部署到服务器,获取用户openid请求api时超时,服务器上没有外网,怎么做?
随便看看
企业微信通讯录账号被管理员误/恶意删除,怎么办? 8444
问题? 7668
如何快速搭建抽奖助手小程序(无需代码知识) 5229
许涛 大哥在吗, 要解冻小程序的时候提示信息主体不一致, 能帮忙看下吗? 6499
小程序搜一搜全称搜索不显示 麻烦解决一下!谢谢 5800
我的小程序广告收款主体是个体工商户,每个月邮寄两次发票很是麻烦,我年底的时候打包邮寄一次可以么? 5459
如何解决渲染层网络错误Failed to load media? 16708
小程序找号找回 释放昵称? 2741
我的小程序广告主收入5301,实际进账4406,是怎么回事呀? 2611
删除部分微信用户个人数据的通知,怎么删除? 5777