跳到主要内容

DateTime():month()

返回 DateTime 对象的月份。(从 1 开始,一月为 1)。

签名

month(): number

返回值

  • 类型:number
  • 月份(1-12)。

示例

local date = DateTime(2024, 3, 15) -- 2024315
local month = date:month()
toast("Month: " .. month) -- 输出:3