PDA

View Full Version : Convert time into a date (with time)?


Nochurch
08-16-2003, 12:00 AM
Hi,

I've got the following problem. In my DB I've got just a time, eg 11:15. Now I want to get this date in such a way that I get todays date and the time which is retrieved by SQL from my DB.

After that I want to add 1 day.

Currently I have this:


strSQL = "SELECT depart from transport where id=10000"
Set rs = conn.Execute(strSQL)
date2use=rs(0)
date2use=DateAdd("d", 1, date2use)


Although this gives me the time, the date is completely wrong, namely 12/31/1899????

How can I attach todays date, which becomes after the dateadd tomorrow's date?

Thanks

raf
08-16-2003, 08:55 PM
Try it like this:

strSQL = "SELECT depart from transport where id=10000"
rs.Open strSQL, conn
date2use=DateAdd("d", 1, rs.Fields("depart"))

glenngv
08-18-2003, 03:55 AM
strSQL = "SELECT depart from transport where id=10000"
rs.Open strSQL, conn
date2use=DateAdd("d", 1, CDate(Date() & " " & rs.Fields("depart")))