<%
'+++++++++++++++++++++++++++++++++++++++
'함수명 : 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)
%>
뭐 꼭 필요한건 아니고요..전에 필요해서 한번 썼던건데요...날짜 관련해서 가끔 쓸만해요..
Happy.....
http://www.taeyo.pe.kr/threadboard/Content.asp?table=Board_Knowhow&seqs=734&page=1&IsSearch=
'WEB > ASP / DotNet' 카테고리의 다른 글
| 강제 다운로드 (0) | 2007/06/07 |
|---|---|
| FSO 파일 이름 그냥 바꾸기 (0) | 2007/06/07 |
| ASP 시간함수 (0) | 2007/06/07 |
| 제가 가끔 쓰는 ASP 문자열함수+ 디버깅함수 (0) | 2007/06/07 |
| 제가 가끔 쓰는 ASP 파일처리 함수 (0) | 2007/06/07 |
| XMLHTTP 를 이용한 페이지 Refresh 효과 (0) | 2007/06/07 |




최근에 달린 댓글
링크
최근에 받은 트랙백
태그목록