请教asp的时间问题

来源:百度知道 编辑:UC知道 时间:2024/05/10 08:14:04
我的同学录在虚拟主机上出现这个错误,要怎们改

Microsoft JET Database Engine- Error '800e4e0c'

查询运算式 'isonline=true and logtime<#2006/9/2 上午 12:17:54#' 中的 日期语法错误。

line 22

听说是该服务器上的时间格式可是我们能改吗??

可以先将日期转换之后再进行比较
'************************************************
'** 转换日期到长型(即:2000-01-01 12:00:00)
'************************************************
Private Function FormatDate(strDate)
Dim strOut
Dim strDay
Dim strMonth
Dim strYear
Dim strHour
Dim strMinute
Dim strSecond

strDay = Right(CStr("00" & Day(strDate)),2)
strMonth = Right(CStr("00" & Month(strDate)),2)
strYear = Right(CStr("2000" & Year(strDate)),4)
strHour = Right(CStr("00" & Hour(strDate)),2)
strMinute = Right(CStr("00" & Minute(strDate)),2)
strSecond = Right(CStr("00" & Second(strDate)),2)

strOut = strYear & "-" & strMonth & "-" & strDay & " " & strHour & ":" & strMinute & ":" & strSecond

FormatDate = strOut
End Function

如:
strSQL = "SELECT 字段列表 F