Lua中ISO 8601的时间戳 [英] Timestamp to ISO 8601 in Lua

查看:243
本文介绍了Lua中ISO 8601的时间戳的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Lua中将时间戳转换为ISO 8601格式(例如2009-01-28T21:49:59.000Z)?

How would you convert a timestamp to an ISO 8601 format (such as 2009-01-28T21:49:59.000Z) in Lua?

我正在专门尝试通过使用Nginx中的 HttpLuaModule 来做到这一点.

I'm specifically trying to do it by using the HttpLuaModule in Nginx.

推荐答案

如果t具有从纪元开始的秒数,请尝试os.date("!%Y-%m-%dT%TZ")os.date("!%Y-%m-%dT%TZ",t).

Try os.date("!%Y-%m-%dT%TZ") or os.date("!%Y-%m-%dT%TZ",t) if t has the date in seconds since the epoch.

这篇关于Lua中ISO 8601的时间戳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆