| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 544 人关注过本帖
标题:asp+access 英文日期怎么显示啊 我这个是这样显示的2011-4-27 怎么才 ...
只看楼主 加入收藏
guang2356447
Rank: 2
等 级:论坛游民
帖 子:434
专家分:31
注 册:2007-7-10
结帖率:65.85%
收藏
已结贴  问题点数:18 回复次数:1 
asp+access 英文日期怎么显示啊 我这个是这样显示的2011-4-27 怎么才能反过来显示
asp+access   英文日期怎么显示啊   我这个是这样显示的2011-4-27    怎么才能反过来显示

显示成27-4-2011
搜索更多相关主题的帖子: 英文日期 
2011-09-07 11:31
dzt0001
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:蒙面侠
威 望:5
帖 子:1281
专家分:4998
注 册:2005-10-12
收藏
得分:18 

默认的日期时间格式是根据系统的区域和语言选项来控制的

给你一个通用的ASP时间格式函数,可以转换为想要的格式
程序代码:
<%
'功能:日期格式化函数
'将日期格式化为ISO8601格式
'Response.Write(FormatDate("2007-03-06 07:03:06", "YYYY-MM-DDThh:mm:ss.000+08:00"))
'将日期格式化为(英文星期, 月/日/年)
'Response.Write(FormatDate(Now(), "eW, MM/DD/YYYY"))
Function FormatDate(sDataTime, sReallyDo)
    Dim sLocale
    If Not IsDate(sDataTime) Then FormatDate = "" : Exit Function
    sDataTime = CDate(sDataTime)
    Select Case sReallyDo & ""
        Case "0", "1", "2", "3", "4"
            FormatDate = FormatDateTime(sDataTime, sReallyDo)
        Case Else
            FormatDate = sReallyDo
            FormatDate = Replace(FormatDate, "YYYY", Year(sDataTime))
            FormatDate = Replace(FormatDate, "MM", Right("0" & Month(sDataTime), 2))
            FormatDate = Replace(FormatDate, "DD", Right("0" & Day(sDataTime), 2))
            FormatDate = Replace(FormatDate, "hh", Right("0" & Hour(sDataTime), 2))
            FormatDate = Replace(FormatDate, "mm", Right("0" & Minute(sDataTime), 2))
            FormatDate = Replace(FormatDate, "ss", Right("0" & Second(sDataTime), 2))
            FormatDate = Replace(FormatDate, "YY", Right(Year(sDataTime), 2))
            FormatDate = Replace(FormatDate, "M", Month(sDataTime))
            FormatDate = Replace(FormatDate, "D", Day(sDataTime))
            FormatDate = Replace(FormatDate, "h", Hour(sDataTime))
            FormatDate = Replace(FormatDate, "m", Minute(sDataTime))
            FormatDate = Replace(FormatDate, "s", Second(sDataTime))
            If InStr(1, FormatDate, "EW", 1) > 0 Then
            sLocale = GetLocale()
                SetLocale("en-gb")
                FormatDate = Replace(FormatDate, "EW", UCase(WeekdayName(Weekday(sDataTime), False)))
                FormatDate = Replace(FormatDate, "eW", WeekdayName(Weekday(sDataTime), False))
                FormatDate = Replace(FormatDate, "Ew", UCase(WeekdayName(Weekday(sDataTime), True)))
                FormatDate = Replace(FormatDate, "ew", WeekdayName(Weekday(sDataTime), True))
                SetLocale(sLocale)
            Else
                FormatDate = Replace(FormatDate, "W", WeekdayName(Weekday(sDataTime), False))
                FormatDate = Replace(FormatDate, "w", WeekdayName(Weekday(sDataTime), True))
            End If
    End Select
End Function


Response.Write(FormatDate("2011-4-27", "D-M-YYYY"))

%>

----我怎能在别人的苦难面前转过脸去----
2011-09-07 14:51
快速回复:asp+access 英文日期怎么显示啊 我这个是这样显示的2011-4-27 ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.021877 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved