This is a function that I created to insert dates and times into an Access database in this format "YYYY-MM-DD HH:MM:SS"
It seems to work fine.
Can anyone see any difficulties with the function causing problems on a UK or US server?
<%
Function AccessDateTime (str)
Dim aDay
Dim aMonth
Dim aYear
Dim aTime
aDay = Day(str)
aMonth = Month(str)
aYear = Year(str)
aTime = Time()
AccessDateTime = aYear & "-" & aMonth & "-" & aDay & " " & aTime
End Function
dim connection
dim sSQL, sConnString
sSQL="INSERT INTO tblDate (dDate) VALUES (#" & AccessDateTime(NOW()) & "#)"
sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath("datedb.mdb")
Set connection = Server.CreateObject("ADODB.Connection")
connection.Open(sConnString)
connection.execute(sSQL)
Connection.Close
Set Connection = Nothing
%>
It seems to work fine.
Can anyone see any difficulties with the function causing problems on a UK or US server?
<%
Function AccessDateTime (str)
Dim aDay
Dim aMonth
Dim aYear
Dim aTime
aDay = Day(str)
aMonth = Month(str)
aYear = Year(str)
aTime = Time()
AccessDateTime = aYear & "-" & aMonth & "-" & aDay & " " & aTime
End Function
dim connection
dim sSQL, sConnString
sSQL="INSERT INTO tblDate (dDate) VALUES (#" & AccessDateTime(NOW()) & "#)"
sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath("datedb.mdb")
Set connection = Server.CreateObject("ADODB.Connection")
connection.Open(sConnString)
connection.execute(sSQL)
Connection.Close
Set Connection = Nothing
%>