西安网站制作ASP日期转换函数

16072012-04-13

    Function DateToStr(DateTime,ShowType)  '西安网站制作ASP日期转换函数
         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
         If Len(DateMinute)<2 Then DateMinute="0"&DateMinute
         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      
               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(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(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
               DateToStr=Year(DateTime)&"-"&DateMonth&"-"&DateDay&" "&DateHour&":"&DateMinute
         End Select
    End Function

通过本文您对西安网站建设有了进一步了解,本公司温馨提醒:找西安做网站公司,请选择手续齐全、业务精、服务好的正规公司。

工商网上亮照

版权所有:西安点墨网络科技有限公司 信息备案编号: 陕ICP备11004160号-1

客户服务电话:029-89640155 18991365125

公司地址:西安市雁塔区朱雀大街紫郡长安F3

Sitemap 网站地图 手机版

办公电话:029-89640155

服务热线:18991365125

客服信箱:vip@dianmo.cc

846461336327

西安点墨网络科技有限公司

版权所有:西安点墨网络科技有限公司 信息备案编号: 陕ICP备11004160号-1