ASP日期转换
把2009-01-01这种格式转成2009-1-1ACCESSS中默认的存储时间和我表单提交的时间格式有冲突帮忙一下...
把2009-01-01这种格式转成2009-1-1
ACCESSS中默认的存储时间和我表单提交的时间格式有冲突
帮忙一下 展开
ACCESSS中默认的存储时间和我表单提交的时间格式有冲突
帮忙一下 展开
9个回答
展开全部
AddTime=2010-10-10 10:10:10
year(rs("AddTime"))&"-"&month(rs("AddTime"))&"-"&day(rs("AddTime"))
ACCESSS中的字段属性不要用时间的就行了!提交前判断一下时间的格式是否符合就OK了!为什么要那么麻烦呢!
year(rs("AddTime"))&"-"&month(rs("AddTime"))&"-"&day(rs("AddTime"))
ACCESSS中的字段属性不要用时间的就行了!提交前判断一下时间的格式是否符合就OK了!为什么要那么麻烦呢!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
打开ACCESS数据库 找到储存时间的那列, 打开设计试图,把时间那列的时间格式改为短日期。。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
数据库改成 日期类型即可
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐于2016-09-23
展开全部
Public 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
If Len(DateMinute)<2 Then DateMinute="0"&DateMinute
Select Case ShowType
Case "Y-m-d" 'eg:2006-02-22
DateToStr=Year(DateTime)&"-"&DateMonth&"-"&DateDay
Case "Y.M/d" 'eg:06.02/22
DateToStr=right(Year(DateTime),2)&"."&DateMonth&"/"&DateDay
Case "M/d" 'eg:02/22
DateToStr=DateMonth&"/"&DateDay
Case "H:I" 'eg:11:02
Dim DateAMPM
If Len(DateHour)<2 Then DateHour="0"&DateHour
DateToStr=DateHour&":"&DateMinute
Case "Y-m-d H:I" 'eg:2006-02-22 11:02
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
Case "YmdHIS" 'eg:20060222112404
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 "y-m" 'eg:2006-02
DateToStr=Year(DateTime)&"-"&DateMonth
Case "d" 'eg:22
DateToStr=DateDay
Case "mxdx" 'eg:02月22日
DateToStr=DateMonth&"月"&DateDay&"日"
Case "yxmx" 'eg:2006年02月22日
DateToStr=Year(DateTime)&"年"&DateMonth&"月"
Case "all" 'eg:2006年02月22日 11:02:33
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 "yxmxdx" 'eg:2006年02月22日
DateToStr=Year(DateTime)&"年"&DateMonth&"月"&DateDay&"日"
Case Else 'eg:2006-02-22 11:02
If Len(DateHour)<2 Then DateHour="0"&DateHour
DateToStr=Year(DateTime)&"-"&DateMonth&"-"&DateDay&" "&DateHour&":"&DateMinute
End Select
End Function
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" 'eg:2006-02-22
DateToStr=Year(DateTime)&"-"&DateMonth&"-"&DateDay
Case "Y.M/d" 'eg:06.02/22
DateToStr=right(Year(DateTime),2)&"."&DateMonth&"/"&DateDay
Case "M/d" 'eg:02/22
DateToStr=DateMonth&"/"&DateDay
Case "H:I" 'eg:11:02
Dim DateAMPM
If Len(DateHour)<2 Then DateHour="0"&DateHour
DateToStr=DateHour&":"&DateMinute
Case "Y-m-d H:I" 'eg:2006-02-22 11:02
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
Case "YmdHIS" 'eg:20060222112404
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 "y-m" 'eg:2006-02
DateToStr=Year(DateTime)&"-"&DateMonth
Case "d" 'eg:22
DateToStr=DateDay
Case "mxdx" 'eg:02月22日
DateToStr=DateMonth&"月"&DateDay&"日"
Case "yxmx" 'eg:2006年02月22日
DateToStr=Year(DateTime)&"年"&DateMonth&"月"
Case "all" 'eg:2006年02月22日 11:02:33
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 "yxmxdx" 'eg:2006年02月22日
DateToStr=Year(DateTime)&"年"&DateMonth&"月"&DateDay&"日"
Case Else 'eg:2006-02-22 11:02
If Len(DateHour)<2 Then DateHour="0"&DateHour
DateToStr=Year(DateTime)&"-"&DateMonth&"-"&DateDay&" "&DateHour&":"&DateMinute
End Select
End Function
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询