M
middletree
I've been messing with this for hours, and have been to various sites,
including Aaron's site, and am truly stumped.
The short version: in SQL Server, the 4 fields in question are datetime. I
have a page that allows users to type in the info (actually a calendar
pop-up allows me to make sure they do it in the correct format), into a
textbox.
When this page gets called up again, I want to prefill the box with the
existing data, in case they need to change it. This is where the problem
comes in. SQL Server has gone and changed the time to a format which has AM
or PM at the end. And that's fine. But this calendar deal picks up the time
without the PM. So all of a sudden, 1:30 PM becomes 1:30, which then gets
saved as 1:30 AM.
Because the calendar depends a lot on Javascript, I am not willing to change
the code too much, as I have very little JS knowledge. So I have decided to
use ASP to change the data after I have retrieved it.
Here's my code:
dtTempDate = rs("TempSolution")
str24hourDate = FormatDateTime(dtTempDate,2)
str24hourTime = FormatDateTime(dtTempDate,4)
int24hourSecond = DatePart("s",dtTempDate)
if int24hourSecond = 0 then
str24hourSecond = "00"
else
if int24hourSecond < 10 then
str24hourSecond = "0" & cstr(int24hourSecond)
else str24hourSecond = Cstr(int24hourSecond)
end if
end if
strTempSolution = str24hourDate & " " & str24hourTime & ":" &
str24hourSecond
I am getting this error:
=======
Microsoft VBScript runtime error '800a000d'
Type mismatch: 'FormatDateTime'
=======
And the line cited is
str24hourDate = FormatDateTime(dtTempDate,2)
which is the first line where I try to do any formatting.
When I comment out that line, I just get the same error on the next line.
What's wierd is that this was working, and just stopped working. I promise I
didn't change a thing between the time it worked and when it didn't.
Any help resolving this error appreciated.
including Aaron's site, and am truly stumped.
The short version: in SQL Server, the 4 fields in question are datetime. I
have a page that allows users to type in the info (actually a calendar
pop-up allows me to make sure they do it in the correct format), into a
textbox.
When this page gets called up again, I want to prefill the box with the
existing data, in case they need to change it. This is where the problem
comes in. SQL Server has gone and changed the time to a format which has AM
or PM at the end. And that's fine. But this calendar deal picks up the time
without the PM. So all of a sudden, 1:30 PM becomes 1:30, which then gets
saved as 1:30 AM.
Because the calendar depends a lot on Javascript, I am not willing to change
the code too much, as I have very little JS knowledge. So I have decided to
use ASP to change the data after I have retrieved it.
Here's my code:
dtTempDate = rs("TempSolution")
str24hourDate = FormatDateTime(dtTempDate,2)
str24hourTime = FormatDateTime(dtTempDate,4)
int24hourSecond = DatePart("s",dtTempDate)
if int24hourSecond = 0 then
str24hourSecond = "00"
else
if int24hourSecond < 10 then
str24hourSecond = "0" & cstr(int24hourSecond)
else str24hourSecond = Cstr(int24hourSecond)
end if
end if
strTempSolution = str24hourDate & " " & str24hourTime & ":" &
str24hourSecond
I am getting this error:
=======
Microsoft VBScript runtime error '800a000d'
Type mismatch: 'FormatDateTime'
=======
And the line cited is
str24hourDate = FormatDateTime(dtTempDate,2)
which is the first line where I try to do any formatting.
When I comment out that line, I just get the same error on the next line.
What's wierd is that this was working, and just stopped working. I promise I
didn't change a thing between the time it worked and when it didn't.
Any help resolving this error appreciated.