Skip to main content

DateTime():date()

Sets the day of the month of the DateTime object.

Signature​

date(date: number): DateTime

Parameters​

ParameterTypeDescription
datenumberThe day of the month to set (1-31).

Returns​

  • Type: DateTime
  • The current DateTime instance for chaining.

Examples​

local date = DateTime(2024, 1, 15)
date:date(20)
toast("New date: " .. date:format("yyyy-MM-dd")) -- Output: 2024-01-20