ORF反垃圾邮件系统

邮件服务器-邮件系统-邮件技术论坛(BBS)

 找回密码
 会员注册
查看: 2663|回复: 3
打印 上一主题 下一主题

[求助] 求助,帮写个转换成中文的函数

[复制链接]
跳转到指定楼层
顶楼
发表于 2008-8-4 17:03:12 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<%= etime&"-"&WeekDay(etime)%>
显示效果例如:2008年7月28日 20:30:01(星期一)
沙发
发表于 2008-8-5 19:03:25 | 只看该作者

  1. response.write ShowDataInfo(now(),"Y年m月d日 H:I:S 周")
  2. Function ShowDataInfo(DateTime,ShowType)
  3.         if isBlank(DateTime) then Exit Function
  4.         Dim DateMonth,DateDay,DateHour,DateMinute,DateWeek,DateSecond
  5.         Dim FullWeekday,shortWeekday,WeekdayCN,Fullmonth,Shortmonth,TimeZone1,TimeZone2
  6.         TimeZone1="+0800"
  7.         TimeZone2="+08:00"
  8.         FullWeekday=Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
  9.         shortWeekday=Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat")
  10.         WeekdayCN=Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六")
  11.         Fullmonth=Array("January","February","March","April","May","June","July","August","September","October","November","December")
  12.         Shortmonth=Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")

  13.         DateMonth=Month(DateTime)
  14.         DateDay=Day(DateTime)
  15.         DateHour=Hour(DateTime)
  16.         DateMinute=Minute(DateTime)
  17.         DateWeek=weekday(DateTime)
  18.         DateSecond=Second(DateTime)
  19.         if Len(DateMonth)<2 then DateMonth="0"&DateMonth
  20.         if Len(DateDay)<2 then DateDay="0"&DateDay
  21.         if Len(DateMinute)<2 then DateMinute="0"&DateMinute
  22.         Select Case ShowType
  23.                 Case "Y-m-d" ShowDataInfo=Year(DateTime)&"-"&DateMonth&"-"&DateDay
  24.                 Case "m.d" ShowDataInfo=DateMonth&"."&DateDay
  25.                 Case "Y.m.d" ShowDataInfo=Year(DateTime)&"."&DateMonth&"."&DateDay
  26.                 Case "Y-m-d w" ShowDataInfo=Year(DateTime)&"-"&DateMonth&"-"&DateDay&" "&FullWeekday(DateWeek-1)
  27.                 Case "Y年m月d日" ShowDataInfo=Year(DateTime)&"年"&DateMonth&"月"&DateDay&"日"
  28.                 Case "Y年m月d日 周"  ShowDataInfo=Year(DateTime)&"年"&DateMonth&"月"&DateDay&"日 "&WeekdayCN(DateWeek-1)
  29.                 Case "Y年m月d日 H:I:S 周"  ShowDataInfo=Year(DateTime)&"年"&DateMonth&"月"&DateDay&"日 "&DateHour&":"&DateMinute&":"&DateSecond&" "&WeekdayCN(DateWeek-1)       
  30.                 Case "Y-m-d H:I A"
  31.                         Dim DateAMPM
  32.                         if DateHour>12 then
  33.                                 DateHour=DateHour-12
  34.                                 DateAMPM="PM"
  35.                         else
  36.                                 DateHour=DateHour
  37.                                 DateAMPM="AM"
  38.                         end if
  39.                         if Len(DateHour)<2 then DateHour="0"&DateHour       
  40.                         ShowDataInfo=Year(DateTime)&"-"&DateMonth&"-"&DateDay&" "&DateHour&":"&DateMinute&" "&DateAMPM
  41.                 Case "Y-m-d H:I:S"
  42.                         if Len(DateHour)<2 then DateHour="0"&DateHour       
  43.                         if Len(DateSecond)<2 then DateSecond="0"&DateSecond
  44.                         ShowDataInfo=Year(DateTime)&"-"&DateMonth&"-"&DateDay&" "&DateHour&":"&DateMinute&":"&DateSecond
  45.                 Case "Y-m-d H:I:S w"
  46.                         if Len(DateHour)<2 then DateHour="0"&DateHour       
  47.                         if Len(DateSecond)<2 then DateSecond="0"&DateSecond
  48.                         ShowDataInfo=Year(DateTime)&"-"&DateMonth&"-"&DateDay&" "&DateHour&":"&DateMinute&":"&DateSecond&" "&FullWeekday(DateWeek-1)                       
  49.                 Case "YmdHIS"
  50.                         DateSecond=Second(DateTime)
  51.                         if Len(DateHour)<2 then DateHour="0"&DateHour       
  52.                         if Len(DateSecond)<2 then DateSecond="0"&DateSecond
  53.                         ShowDataInfo=Year(DateTime)&DateMonth&DateDay&DateHour&DateMinute&DateSecond       
  54.                 Case "ym" ShowDataInfo=Right(Year(DateTime),2)&DateMonth
  55.                 Case "d" ShowDataInfo=DateDay
  56.                 Case "ymd" ShowDataInfo=Right(Year(DateTime),4)&DateMonth&DateDay
  57.                 Case "mdy"
  58.                         Dim DayEnd
  59.                         Select Case DateDay
  60.                                 Case 1 DayEnd="st"
  61.                                 Case 2 DayEnd="nd"
  62.                                 Case 3 DayEnd="rd"
  63.                                 Case else DayEnd="th"
  64.                         End Select
  65.                         ShowDataInfo=Fullmonth(DateMonth-1)&" "&DateDay&DayEnd&" "&Right(Year(DateTime),4)
  66.                 Case "w,d m y H:I:S"
  67.                         DateSecond=Second(DateTime)
  68.                         if Len(DateHour)<2 then DateHour="0"&DateHour       
  69.                         if Len(DateSecond)<2 then DateSecond="0"&DateSecond
  70.                         ShowDataInfo=shortWeekday(DateWeek-1)&","&DateDay&" "& Left(Fullmonth(DateMonth-1),3) &" "&Right(Year(DateTime),4)&" "&DateHour&":"&DateMinute&":"&DateSecond&" "&TimeZone1
  71.                 Case "y-m-dTH:I:S"
  72.                         if Len(DateHour)<2 then DateHour="0"&DateHour       
  73.                         if Len(DateSecond)<2 then DateSecond="0"&DateSecond
  74.                         ShowDataInfo=Year(DateTime)&"-"&DateMonth&"-"&DateDay&"T"&DateHour&":"&DateMinute&":"&DateSecond&TimeZone2
  75.                 Case else
  76.                         if Len(DateHour)<2 then DateHour="0"&DateHour
  77.                         ShowDataInfo=Year(DateTime)&"-"&DateMonth&"-"&DateDay&" "&DateHour&":"&DateMinute
  78.         End Select
  79. End Function
复制代码

评分

参与人数 1经验积分 +3 技术积分 +3 5D金币 +2 收起 理由
rayer + 3 + 3 + 2

查看全部评分

藤椅
发表于 2008-8-6 10:10:11 | 只看该作者
顶一下二楼先。。
板凳
 楼主| 发表于 2008-8-6 15:52:17 | 只看该作者
谢谢,代码很好
您需要登录后才可以回帖 登录 | 会员注册

本版积分规则

小黑屋|手机版|Archiver|邮件技术资讯网

GMT+8, 2024-12-22 13:03

Powered by Discuz! X3.2

© 2001-2016 Comsenz Inc.

本论坛为非盈利中立机构,所有言论属发表者个人意见,不代表本论坛立场。内容所涉及版权和法律相关事宜请参考各自所有者的条款。
如认定侵犯了您权利,请联系我们。本论坛原创内容请联系后再行转载并务必保留我站信息。此声明修改不另行通知,保留最终解释权。
*本论坛会员专属QQ群:邮件技术资讯网会员QQ群
*本论坛会员备用QQ群:邮件技术资讯网备用群

快速回复 返回顶部 返回列表