Last Sync: 2026-01-08 23:40 (Mobile)
This commit is contained in:
20
새로운 5.txt
Normal file
20
새로운 5.txt
Normal file
@@ -0,0 +1,20 @@
|
||||
<%*
|
||||
function getWeekOfMonth(date) {
|
||||
const year = date.getFullYear();
|
||||
const month = date.getMonth();
|
||||
const firstDayOfMonth = new Date(year, month, 1);
|
||||
const firstWeekdayOfMonth = firstDayOfMonth.getDay();
|
||||
const dayOfMonth = date.getDate();
|
||||
|
||||
const offset = (firstWeekdayOfMonth === 0 ? 6 : firstWeekdayOfMonth - 1);
|
||||
const weekNumber = Math.floor((dayOfMonth + offset - 1) / 7) + 1;
|
||||
|
||||
return weekNumber;
|
||||
}
|
||||
|
||||
const dateStr = "2024-07-18";
|
||||
const date = new Date(dateStr);
|
||||
|
||||
const weekOfMonth = getWeekOfMonth(date);
|
||||
tR += `${dateStr}는 ${date.getMonth() + 1}월의 ${weekOfMonth}번째 주에 속합니다.`;
|
||||
%>
|
||||
Reference in New Issue
Block a user