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

DateTime():hour()

DateTime オブジェクトの時刻の時間を返します。(24時間形式、0〜23)

シグネチャ

hour(): number

戻り値

  • 型: number
  • 時間(0〜23)。

local date = DateTime(2024, 1, 15, 14, 30, 0) -- 午後2:30
local hourOfDay = date:hour()
toast("Hour of the day: " .. hourOfDay) -- 出力: 14