Aller au contenu principal

DateTime():hour()

Returns the hour of the day of the DateTime object. (24-hour format, 0-23).

Signature

hour(): number

Returns

  • Type: number
  • The hour (0-23).

Examples

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