DateTime():startOf()
DateTime 객체를 지정한 시간 단위의 시작으로 설정합니다 (예: 하루의 시작, 한 달의 시작).
시그니처
startOf(unit: string): DateTime
매개변수
| 매개변수 | 유형 | 설명 |
|---|---|---|
unit | string | 시작으로 설정할 시간 단위. 지원되는 단위: year, month, week, day, hour, minute, second |
반환값
- 유형:
DateTime - 현재
DateTime인스턴스이며, 메서드 체이닝이 가능합니다.
예시
local now = DateTime()
-- 현재 일의 시작으로 설정
now:startOf("day")
toast("일의 시작: " .. now:format("yyyy-MM-dd HH:mm:ss.SSS"))
-- 현재 월의 시작으로 설정
now = DateTime() -- 초기화
now:startOf("month")
toast("월의 시작: " .. now:format("yyyy-MM-dd HH:mm:ss.SSS"))
-- 현재 연도의 시작으로 설정
now = DateTime() -- 초기화
now:startOf("year")
toast("연도의 시작: " .. now:format("yyyy-MM-dd HH:mm:ss.SSS"))