DateTime():isBetween()
현재 DateTime 객체가 두 개의 다른 DateTime 객체 사이에 있는지(경계값 포함) 확인합니다.
시그니처
isBetween(start: DateTime, end: DateTime): boolean
매개변수
| 매개변수 | 유형 | 설명 |
|---|---|---|
start | DateTime | 시작 DateTime 객체. |
end | DateTime | 종료 DateTime 객체. |
반환값
- 유형:
boolean - 현재
DateTime이start와end사이에 있으면(경계값 포함)true, 그렇지 않으면false.
예시
local date = DateTime(2024, 1, 15)
local start = DateTime(2024, 1, 10)
local end_date = DateTime(2024, 1, 20)
local result1 = date:isBetween(start, end_date) -- 결과는 true
toast(tostring(result1))
local dateOutside = DateTime(2024, 1, 25)
local result2 = dateOutside:isBetween(start, end_date) -- 결과는 false
toast(tostring(result2))