DateTime():isSame()
Checks if the current DateTime object is the same as another DateTime object.
Signature
isSame(other: DateTime): boolean
Parameters
Parameter | Type | Description |
---|---|---|
other | DateTime | The other DateTime object to compare against. |
Returns
- Type:
boolean
true
if the currentDateTime
is the same as theother
DateTime,false
otherwise.
Examples
local date1 = DateTime(2024, 1, 10, 10, 30, 0)
local date2 = DateTime(2024, 1, 10, 10, 30, 0)
local date3 = DateTime(2024, 1, 10, 11, 0, 0)
local result1 = date1:isSame(date2) -- result will be true
toast(tostring(result1))
local result2 = date1:isSame(date3) -- result will be false
toast(tostring(result2))