Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subtracting MINUES from a Date/Time

Status
Not open for further replies.

smilbert

IS-IT--Management
Aug 28, 2006
36
US
I have an APPOINTMENT Date/Time field in SQL. I also have a LeadTime (number of minutes) that need to be subracted to show an ARRIVAL time (no need for the date).

I first tried to subtract the NUMBER from the Time(APPT), but it subtracted seconds. Next, I tried using
Time(0,LeadTime,0), but it didn't like Minutes being greater than 60 (it is either 15 or 90 minutes).

I added an if/then to change 90 into Time(1,30,0), but now my answer is a number like 33,300.

Is there an easier way to do this?
What do I have to do to convert the 33,000 into a TIME?
 
Try:

Dateadd("n",{table.minutes}*-1,{table.datetime})

or

dateserial(year({table.datetime}),hour({table.datetime}),{table.minutes}*-1)

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top