'+++++++++++++++++++++++++++++++++++++++
'함수명 : getWeekDayNum(chkDate)
'인자 : chkDate - 문자열
'기능 : 날짜를 받아 날짜의 정수값 표현리턴
'+++++++++++++++++++++++++++++++++++++++
Function getWeekDayNum (chkDate)
Dim chkVal
chkVal = WeekDay(chkDate)
getWeekDayNum = chkVal
End Function
'+++++++++++++++++++++++++++++++++++++++
'함수명 : getDayName(chkDate)
'인자 : chkDate - 문자열
'기능 : 날짜를 받아 요일명 리턴
'+++++++++++++++++++++++++++++++++++++++
Function getDayName (chkDate)
Dim chkVal, strDayName
chkVal = WeekDay(chkDate)
strDayName = WeekDayName(chkVal)
getDayName = strDayName
End Function
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'함수명 : getMonthFirstSunday(chkDate)
'인자 : chkDate - 문자열("YYYY-MM-DD")
'기능 : 날짜를 받아 그 달의 첫번째 일요일 날짜 리턴
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Function getMonthFirstSunday(chkDate)
Dim chkVal, thisMonthStart
thisMonthStart = DateSerial(Year(chkDate), Month(chkDate),1)
chkVal = WeekDay(thisMonthStart)
If chkVal = 1 then
getMonthFirstSunday = thisMonthStart
Else
getMonthFirstSunday = DateAdd("d",7-(chkVal-1) , thisMonthStart)
End If
End Function
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'함수명 : getMonthLastSunday(chkDate)
'인자 : chkDate - 문자열
'기능 : 날짜를 받아 그 달의 마지막 일요일 날짜 리턴
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Function getMonthLastSunday(chkDate)
Dim chkVal, nextMonthStart
nextMonthStart = DateSerial(Year(chkDate), Month(chkDate)+1,1)
chkVal = WeekDay(nextMonthStart)
If chkVal = "1" then
getMonthLastSunday = DateAdd("ww",-1, nextMonthStart)
Else
getMonthLastSunday = DateAdd("d",-(chkVal-1) , nextMonthStart)
End If
End Function
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'함수명 : getWeekSunDay(chkDate)
'인자 : chkDate - 문자열
'기능 : 날짜를 받아 날짜의 주차의 해당 일요일을 리턴
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Function getWeekSunDay(chkDate)
Dim chkVal, firstSunDay
firstSunday = getMonthFirstSunDay(chkDate)
diff = DateDiff("ww",firstSunday, chkDate)
If diff = 0 then
getWeekSunDay = firstSunday
Else
getWeekSunDay = DateAdd("ww",diff,firstSunday)
End If
End Function
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'함수명 : getWeekSunDayCnt(chkDate)
'인자 : chkDate - 문자열
'기능 : 날짜를 받아 날짜의 주차의 해당 일요일의 그 달의 카운터를 리턴
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Function getWeekSunDayCnt(chkDate)
Dim chkVal, firstSunDay
firstSunday = getMonthFirstSunDay(chkDate)
diff = DateDiff("ww",firstSunday, chkDate)
If diff = 0 then
getWeekSunDayCnt = 1
Else
getWeekSunDayCnt = diff+1
End If
End Function
'+++++++++++++++++++++++++++++++++++++++
'서브명 : subDayInfo(chkDate)
'인자 : chkDate - 문자열
'기능 : 날짜를 받아 요일명, 요일 번호, 그 달의 첫번째 일요일, 마지막 일요일 값 리턴
'+++++++++++++++++++++++++++++++++++++++
Sub subDayInfo(chkDate)
dayName = getDayName(chkDate)
dayVbVal = getWeekDayNum(chkDate)
firstSunday = getMonthFirstSunday(chkDate)
lastSunday = getMonthLastSunday(chkDate)
response.write chkDate &"관련 정보<br>"
response.write "요일 : "& dayName&"<br>"
response.write "정수값 : "& dayVbVal&"<br>"
response.write "그 달의 첫번째 일요일 : "& firstSunDay&"<br>"
response.write "그 달의 마지막 일요일 : "& lastSunDay&"<br>"
End Sub
chkDate = "2003-07-22"
Call subDayInfo(chkDate)
response.write getWeekSunDay(chkDate)&":"
response.write getWeekSunDayCnt(chkDate)
%>
영삼넷
Categories
Recent Posts
Recent Comments
Statistics
- Total Visitors:
- 527781
- Today:
- 684922
- Yesterday:
- 9753111
IT강국 김영삼 블로그에 오신걸 진심으로 환영합니다.
©2002 영삼넷 // openkr
©2002 영삼넷 // openkr