msaccessデータベースから日時を読みたい。
列のデータ型はDATETIMEで、値は次のとおりです:1/27/12 5:10 PM
<html>
<body>
<%
Dim Conn
Dim Rs
Dim sql
Dim sConnection
Dim Today as Date //this gives error - unexpected end of file , i want to display current date and time ???
Set Conn = Server.CreateObject("ADODB.Connection")
Set Rs = Server.CreateObject("ADODB.Recordset")
filepath= Server.MapPath ("mydb.mdb")
sConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & filepath
Conn.Open(sConnection)
sql="select * from items;"
Set Rs = Conn.Execute(sql)
if Rs.EOF then
Response.write("No records found")
else
do until rs.eof
ctime = rs("itemadditiondatetime")
Response.write("<br/>Time : <input name='dateandtime[]' value=" & ctime & "/>" & ctime )
rs.movenext
loop
end if
Rs.Close
Conn.Close
Set Rs = Nothing
Set Conn = Nothing
%>
</body>
</html>
すべてのテキストボックスに日付のみが表示され(1/27/12)、時刻は表示されませんが、テキストボックスなしで表示すると、日時全体が表示されます。また、2つのテキストボックスで日付と時刻を別々に取得するにはどうすればよいですか。
また、日付をyyyy-mm-ddとしてフォーマットする必要があります。