• 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
    %>

  • 相关阅读:
    程序员用实力把公司干倒闭了
    可能是把 Java 接口讲得最通俗的一篇文章
    我去,你竟然还不会用 synchronized
    优秀的程序员真的不写注释吗?
    小白,你要的Java抽象类,操碎了心!
    如何将arcgis的mxd文档存储为相对路径
    解决EditorLineEnds.ttr被锁定导致Delphi2006-2010无法启动的问题
    用EXcel制作不同背景的图
    [转载]: delphi中XLSReadWrite控件的使用(1)---简介
    [转载]: delphi中XLSReadWrite控件的使用(2)---delphi XE下安装
  • 原文地址:https://www.cnblogs.com/winner/p/400330.html
Copyright © 2020-2023  润新知