Forums
This topic is locked
Datetime problem
Posted 22 Jan 2006 09:54:22
1
has voted
22 Jan 2006 09:54:22 hasti keyvan posted:
Hello allI have a SQL Server Database that has Datetime column.I want to have an update application with Dreamweaver.I change the Data type of columns belong to Datetime columns in Database to Date, and it is working correctly in my local computer.but when i upload it to net it gives me converting char to datetime error.Is there any one can help me please??where is the problem?
Thank you
keyvan
Replies
Replied 28 Jan 2006 22:44:04
28 Jan 2006 22:44:04 Steve Till-Rogers replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Hello all
I have a SQL Server Database that has Datetime column.I want to have an update application with Dreamweaver.I change the Data type of columns belong to Datetime columns in Database to Date, and it is working correctly in my local computer.but when i upload it to net it gives me converting char to datetime error.Is there any one can help me please??where is the problem?
Thank you
keyvan
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Hi there
My response is not particularly complicated but it worked for me. You need to change the date time format being directed to your SQL server. A snippet of code that I used to do this is below.
Dim SubmitDate
SubmitDate = Now( )
' *** Split date apart, use CDate as base format, put date back together in format SQL understands
Dim SDate
SDate = CDate(SubmitDate)
Dim da
da = DatePart( "d", SDate)
Dim mo
mo = DatePart( "m", SDate)
Dim yr
yr = DatePart( "yyyy", SDate)
Dim tm
tm = Time()
SubmitDate = yr & "-" & mo & "-" & da & " " & hh & " " & tm
Response.write SubmitDate
Hello all
I have a SQL Server Database that has Datetime column.I want to have an update application with Dreamweaver.I change the Data type of columns belong to Datetime columns in Database to Date, and it is working correctly in my local computer.but when i upload it to net it gives me converting char to datetime error.Is there any one can help me please??where is the problem?
Thank you
keyvan
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Hi there
My response is not particularly complicated but it worked for me. You need to change the date time format being directed to your SQL server. A snippet of code that I used to do this is below.
Dim SubmitDate
SubmitDate = Now( )
' *** Split date apart, use CDate as base format, put date back together in format SQL understands
Dim SDate
SDate = CDate(SubmitDate)
Dim da
da = DatePart( "d", SDate)
Dim mo
mo = DatePart( "m", SDate)
Dim yr
yr = DatePart( "yyyy", SDate)
Dim tm
tm = Time()
SubmitDate = yr & "-" & mo & "-" & da & " " & hh & " " & tm
Response.write SubmitDate