DateDiff 라는 함수를 사용하면 간단히 알 수 있습니다.
<%
dim strDate
dim intDay,intMonth,intYear
strDate="2008년 2월 1일"
intDay= datediff("d",strDate,now)
intMonth= datediff("m",strDate,now)
intYear= datediff("yyyy",strDate,now)
dim strDate
dim intDay,intMonth,intYear
strDate="2008년 2월 1일"
intDay= datediff("d",strDate,now)
intMonth= datediff("m",strDate,now)
intYear= datediff("yyyy",strDate,now)
Response.Write "년 경과 : " & intYear & "<br>"
Response.Write "월 경과 : " & intMonth & "<br>"
Response.Write "일 경과 : " & intDay & "<br>"
%>
Response.Write "월 경과 : " & intMonth & "<br>"
Response.Write "일 경과 : " & intDay & "<br>"
%>
위에서 "d", "m", "yyyy"와 같은 옵션들은 다음과 같은 것들이 있습니다.
-------------------------------
-------------------------------
만약 두 날짜 사이에 몇초의 간격이 있는지 구한다면..
DateDiff("s", date1, date2) 와 같이 사용하시면 됩니다.
도움 되시길 바라며 즐거운 하루 되세요.
설명 | |
---|---|
yyyy | 연도 |
q | 분기 |
m | 월 |
y | 일년 중 몇째 날 |
d | 일 |
w | 평일 |
ww | 주 |
h | 시간 |
n | 분 |
s | 초 |
'프로그램 > ASP' 카테고리의 다른 글
다른사이트의 정보를 내사이트에 연동하기 (0) | 2018.03.11 |
---|---|
asp 함수모음 (0) | 2018.03.11 |
ASP와 ASP.net 의 차이점 (0) | 2018.02.26 |