asp格式时间的函数

<%Response.Expires = 0%>
<%
 function FormatDate(sStr,sFormat,sChar)
 if sStr = "" or not isdate(sStr) or sChar="" then
  'Response.Write "NULL"
  FormatDate = ""
  exit function
 end if
 
 dim sYear,sMonth,sDay,sHour,sMinute,sSecond
 sYear = year(sStr)
 if len(sYear)< 4 then sYear ="20" & sYear
 sMonth = month(sStr)
 if clng(sMonth)<10 and len(sMonth)<2 then sMonth = "0" & sMonth
 sDay = day(sStr)
 if clng(sDay)<10 and len(sDay)<2 then sDay = "0" & sDay
 sHour = hour(sStr)
 if clng(sHour)<10 and len(sHour)<2 then sHour = "0" & sHour
 sMinute = Minute(sStr)
 if clng(sMinute)<10 and len(sMinute)<2 then sMinute = "0" & sMinute
 sSecond = Second(sStr)
 if clng(sSecond)<10 and len(sSecond)<2 then sSecond = "0" & sSecond
 
 select case ucase(sFormat)
 case "YYYYMM"
  FormatDate = sYear & sChar & sMonth
 case "YYYYMMDD"
  FormatDate = sYear & sChar & sMonth & sChar & sDay
 case "YYYYMM@"
  FormatDate = sYear & "Äê" & sMonth  & "ÔÂ"
 case "YYYYMMDD@"
  FormatDate = sYear & "Äê" & sMonth & "ÔÂ" & sDay & "ÈÕ"
 case "YYYYMMDDHHMMSS_NULL"
  
  FormatDate = sYear & sMonth & sDay & sHour & sMinute & sSecond
 case "YYYYMMDDHHMMSS"
  FormatDate = sYear & sChar & sMonth & sChar & sDay & " " & sHour & ":"  & sMinute
 case "YYYYMMDDHHMM"
  FormatDate = sYear & sChar & sMonth & sChar & sDay & " " & sHour & ":"  & sMinute 
 case "YYYYMMDDHHMMSS@"
  FormatDate = sYear & "Äê" & sMonth & "ÔÂ" & sDay & "ÈÕ" & sHour & "ʱ"  & sMinute & "·Ö" & sSecond & "Ãë"
   
 case else
  formatDate = sStr   
 end select
end function

function getTextarea(sStr)
 if sStr = "" then
  sStr = ""
 else   
  sStr = Replace(Replace(sStr,chr(10),"<br>"),chr(32),"&nbsp;")  
 end if
 getTextarea = sStr
end function

function getTextareatodb(sStr)
 if sStr = "" then
  sStr = ""
 else   
  sStr = Replace(Replace(sStr,chr(10),"<br>"),chr(32),"&nbsp;")
  
 end if
 getTextareatodb = sStr
end function

function DeTextarea(sStr)
 if sStr = "" then
  sStr = ""
 else
  sStr = Replace(Replace(sStr,"<br>",chr(10)),"&nbsp;",chr(32))
 end if
 DeTextarea = sStr
end function

function pub_getMemoValue(sStr)
 dim s_str
  s_str = sStr
 if s_str = "" or isnull(s_str) then
  pub_getMemoValue = "&nbsp;"
 else
  pub_getMemoValue = rtrim(s_str)
 end if
end function

function pub_getMemoValue_sub(sStr,sLen)
 dim s_str
  s_str = sStr
 if s_str = "" or isnull(s_str) then
  pub_getMemoValue_sub = "&nbsp;"
 else
  if len(s_str)>sLen then
   pub_getMemoValue_sub = rtrim(mid(s_str,1,sLen)) & "..."
  else
   pub_getMemoValue_sub = rtrim(s_str)
  end if
 end if
end function
%>

原文地址:https://www.cnblogs.com/winner/p/400330.html