Aller au contenu principal

DateTime():utc()

Converts the DateTime object's timezone to UTC.

Signature

utc(): DateTime

Returns

  • Type: DateTime
  • The current DateTime instance, with its timezone set to UTC, allowing for method chaining.

Examples

local now = DateTime()
toast("Local time: " .. now:format("yyyy-MM-dd HH:mm:ss Z"))

now:utc()
toast("UTC time: " .. now:format("yyyy-MM-dd HH:mm:ss Z"))