Aller au contenu principal

DateTime():year()

Returns the year of the DateTime object.

Signature

year(): number

Returns

  • Type: number
  • The year (e.g., 2024).

Examples

local date = DateTime(2024, 1, 15)
local year = date:year()
toast("Year: " .. year) -- Output: 2024