[thelist] MSSQL: adding integer to time yields date?

Canfield, Joel JCanfield at PacAdvantage.org
Mon Nov 28 10:20:24 CST 2005


I read about MSSQL and dates and times yesterday and didn't find
anything really helpful about this:

I'm trying to use a smalldatetime field as my starting time and an int
field as the length in hours to calculate the ending time of an event
using VBScript in ASP.

When I add the value of the int field (intLength = 4) to the value of
the smalldatetime field (datStartTime = '8:00PM') it returns the value
'12/31/1899'

No amount of formatting the result or the addends seems to make the
result come out '12:00AM' which is what I would expect.

Is there a simple explanation? Is there a better way? Eventually I want
to provide a web interface for my clients to input their own events, and
I'd like to provide the simplest meaningful options for them; I may have
start time, end time, and duration, and make the latter two optional but
mutually exclusive.

thanks

joel



More information about the thelist mailing list