メインコンテンツまでスキップ

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"))