액세스 데이터베이스의 날짜 및 시간 유형 필드에 저장된 날짜의 경우 데이터베이스에서 데이터를 직접 읽는 효과는 매우 시간이 많이 걸립니다. The Error New Technology Channel의 편집자는 ASP의 일반적으로 사용되는 날짜 서식 함수 형식에 대해 자세히 알려줍니다.
핵심 코드
<%'함수 : 다기능 날짜 서식 기능 : http://jorkin.reallydo.com/article.asp?id=477function 형식 (sdatetime, sreallydo) dim sjorkin sjorkin = getlocale (sdatetime)이면 getlocale (sdatetime = now). CDATE (SDATETIME) CASE UCASE (SREALLYDO & "") CASE "0", "1", "2", "3", "4"FormatDateMA (SDATETIME, SREALLYDO) CASE "00"FormatDate = FormatDate (sdatetime, "yyyy-mm-dd hH : mm : ss"1 "). 형식 (sdateTime, "yyyyyy mm month dd") case "02"formatdate = formatdate ( "yyyy-mm-dd") case "03"formatdate = formatdate (sdatetime, "hh : mm : ss") case "04"formatdate (sdateTate, sdateTate, "HH : MM") CASE "ISO8601", "Google", "Siteemap"// ISO8601 형식, 일반적으로 GooglesItemap에 일반적으로 사용되며 "+08 : 00"은 시간대입니다. formatdate = formatdate (sdateTime, "yyyy-mm-ddthh : mm : ss.000+08 : 00") 사례 "rfc822", "rss", "feed"// rfc822 형식, 일반적으로 RSS에 사용되는 "+0800"은 시간 영역입니다. setLocale ( "en-gb") formatdate = formatdate (sdateTime, "ew, dd emm yyyy hh : mm : ss +0800") setLocale (sjorkin) 사례 "rnd", "rand", "randomize"// randomize "// randomize"// randomize "//"randal " "yyymmddhhmmss") & _ fix ((9 * 10^6-1) * sjorkin) + 10^6 ouse formatdate = sreallydo formatdate = server (formatdate, "yyyy", Year (sdateTime)) formatdate = replare (formatdate, "form (sdateTate)) 대체 (형식 ","HH ", 오른쪽 ("0 "& Hour (sdateTime), 2)) formatdate = cerver (formatdate,"mm ", right ("0 "& minute (sdateTime), 2)) formatdate = replace (formatdate,"SS ", 오른쪽 ("0 "& second (sdateTime))))) 오른쪽 (연도 (sdateTime), 2)) formatdate = replace (formatdate, "d", day (sdateTime)) formatdate = cerver (formatDate, "h", Hour (sdateTime)) formatdate = replace (formatdate, "m", minute (sdatetime)) formatDate = (sdittate =))) 악기 (1, 포맷 데이트, "ew", 1)> 0 그런 다음 setLocale ( "en-gb") formatdate = replace (formatdate, "ew", ucase (WeekdayName (sdateTime, false)) formatdate = replace (formatdate, "ew", formatdate (sdatdate)) "ew", ucase (WeekdayName (sdateTime (sdateTime), true))) formatdate = replace (formatdate, "ew", weekdayname (주중 (sdateTime), true) setLocale (sjorkin) else formatdate = replace (formatdate, "w"))))) 대체 (formatdate, "w", weekdayname (주중 (sdateTime), true)) If inst (1, formatdate, "emm", 1)> 0 다음 setLocale ( "en-gb") formatdate = replare (formatdate, "emm", "formatdate = formatdate (forcous)). MonthName (Month (SdateTime), True)) setLocale (sjorkin) else formatdate = replace (formatdate, "mm", right ( "0"& month (sdatetime), 2)) formatdate = replace (formatdate, "m", month (sdateTime)) function function%를 선택할 경우 종료사용법은 다음과 같습니다.
<%'형식 날짜 ISO8601 형식의 형식 날짜 format response.write (formatdate ( "2008-03-06 08:03:06")') '형식 날짜 RFC822 형식 응답 .write (formatDate ( "2008-03-06 08:03:06")) 연도) response.write (formatdate (now (), "ew, emm/dd/yyyy")) '연도, 월, 일, 시간, 분 및 초 응답 (formatdate (now), "rnd")%>에 임의 숫자를 생성합니다.
위는 잘못된 신기술 채널의 편집자입니다. ASP의 일반적으로 사용되는 날짜 서식 함수 형식에 대한 내용. 이 산업에 관심이 있다면 이와 관련하여 훈련을 제공 할 수 있습니다.