Aller au contenu principal

DateTime():local()

Converts the DateTime object's timezone to the system's default local timezone.

Signature

local(): DateTime

Returns

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

Examples

local now = DateTime()
-- Assuming current system timezone is not 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"))