用户名: 密码: 免费注册 忘记密码? 网站地图 | 加入收藏 | 设为首页
首页 | 新闻 | 工具 | 系统 | 办公 | 聊天 | 多媒体 | 网页 | 运营 | 平面 | 欣赏 | 数据库 | 程序 | 服务器 | 组网
网页 | 3dmax | Ghost | Windows Xp| Dreamweaver | photoshop | Flash | office | Alexa | Css | QQ | Asp | PHP | Jsp | Access
Flash MX 2004入门 | 网站推广策略 | CorelDRAW入门 | ASP学习 | 网站建设大师功 | Word入门
  iTbulo.com > 学院 > 程序开发教程 > ASP教程 > ASP基础教程 > 文章正文
推荐:高手推荐的有用的ASP函数集合
iTbulo.COM 2007-1-10 vibo()

Function HTMLEncode(reString) '过滤转换HTML代码
    Dim Str:Str=reString
    If Not IsNull(Str) Then
        Str = UnCheckStr(Str)
        Str = Replace(Str, "&", "&")
        Str = Replace(Str, ">", ">")
        Str = Replace(Str, "<", "&lt;")
        Str = Replace(Str, CHR(32), "&nbsp;")
        Str = Replace(Str, CHR(9), "&nbsp;&nbsp;&nbsp;&nbsp;")
        Str = Replace(Str, CHR(9), "&nbsp;&nbsp;&nbsp;&nbsp;")
        Str = Replace(Str, CHR(34),""")
        Str = Replace(Str, CHR(39),"&#39;")
        Str = Replace(Str, CHR(13), "")
        Str = Replace(Str, CHR(10), "<br>")
        HTMLEncode = Str
    End If
End Function

Function DateToStr(DateTime,ShowType)  '日期转换函数
    Dim DateMonth,DateDay,DateHour,DateMinute
    DateMonth=Month(DateTime)
    DateDay=Day(DateTime)
    DateHour=Hour(DateTime)
    DateMinute=Minute(DateTime)
    If Len(DateMonth)<2 Then DateMonth="0"&DateMonth
    If Len(DateDay)<2 Then DateDay="0"&DateDay
    Select Case ShowType
    Case "Y-m-d"  
        DateToStr=Year(DateTime)&"-"&DateMonth&"-"&DateDay
    Case "Y-m-d H:I A"
        Dim DateAMPM
        If DateHour>12 Then
            DateHour=DateHour-12
            DateAMPM="PM"
        Else
            DateHour=DateHour
            DateAMPM="AM"
        End If
        If Len(DateHour)<2 Then DateHour="0"&DateHour    
        If Len(DateMinute)<2 Then DateMinute="0"&DateMinute
        DateToStr=Year(DateTime)&"-"&DateMonth&"-"&DateDay&" "&DateHour&":"&DateMinute&" "&DateAMPM
    Case "Y-m-d H:I:S"
        Dim DateSecond
        DateSecond=Second(DateTime)
        If Len(DateHour)<2 Then DateHour="0"&DateHour    
        If Len(DateMinute)<2 Then DateMinute="0"&DateMinute
        If Len(DateSecond)<2 Then DateSecond="0"&DateSecond
        DateToStr=Year(DateTime)&"-"&DateMonth&"-"&DateDay&" "&DateHour&":"&DateMinute&":"&DateSecond
    Case "YmdHIS"
        DateSecond=Second(DateTime)
        If Len(DateHour)<2 Then DateHour="0"&DateHour    
        If Len(DateMinute)<2 Then DateMinute="0"&DateMinute
        If Len(DateSecond)<2 Then DateSecond="0"&DateSecond
        DateToStr=Year(DateTime)&DateMonth&DateDay&DateHour&DateMinute&DateSecond    
    Case "ym"
        DateToStr=Right(Year(DateTime),2)&DateMonth
    Case "d"
        DateToStr=DateDay
    Case Else
        If Len(DateHour)<2 Then DateHour="0"&DateHour
        If Len(DateMinute)<2 Then DateMinute="0"&DateMinute
        DateToStr=Year(DateTime)&"-"&DateMonth&"-"&DateDay&" "&DateHour&":"&DateMinute
    End Select
End Function

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] 下一页

文章搜索
相关资讯
相关文章 相关下载
新手入门:防范SQL注入攻击的新办法
ASP调用SQL Server视图和存储过程
入门教程:ASP设计常见问题及解答精要
在ASP页里面注册DLL的VBScript CLASS
用Dreamweaver+ASP实现网页分页
焦点信息