zoukankan      html  css  js  c++  java
  • 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
    %>

  • 相关阅读:
    Codeforces Round #169 (Div. 2) B. Little Girl and Game(博弈)
    Codeforces Round #167 (Div. 2) C. Dima and Staircase(线段树·成段更新,繁琐)
    Codeforces Round #170 (Div. 2) B. New Problem(好题)
    BKDR Hash Function
    DOC常用命令(转)
    C++ GUI Qt4 自学笔记
    windows如何取消开机启动项
    如何查看电脑配置
    Codeforces Round #166 (Div. 2)C. Secret(构造)
    Codeforces Round #168 (Div. 2) C. kMultiple Free Set(二分查找)
  • 原文地址:https://www.cnblogs.com/winner/p/400330.html
Copyright © 2011-2022 走看看