DateTime():local()
将 DateTime 对象的时区转换为系统默认的本地时区。
签名
local(): DateTime
返回值
- 类型:
DateTime - 当前的
DateTime实例,其时区已设置为本地默认时区,可用于方法链式调用。
示例
local now = DateTime()
-- 假设当前系统时区不是 UTC
now:utc()
toast("UTC time: " .. now:format("yyyy-MM-dd HH:mm:ss Z"))
now:local()
toast("Local time: " .. now:format("yyyy-MM-dd HH:mm:ss Z"))