Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Is it possible to subtract time

Author  Topic 

sfjtraps
Yak Posting Veteran

65 Posts

Posted - 2009-02-19 : 10:38:09
In SQL Reports I have a dateTime parameter with a default value of =Now(). Does anyone know if it is possible to configure the =Now() function so that 15 minutes can be subtracted from it?

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2009-02-19 : 11:17:08
Microsoft SQL Server does not have now() function. If you pass your parameter into a SQL Server you can use
dateadd(min,-15,yourDate) or in vb

Dim adate As Date

adate = Now()
adate = DateAdd("n", -15, adate)

Jim
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-02-19 : 11:31:26
dateadd(mi,-15,datefield)
or
dateadd(n,-15.datefield)
Go to Top of Page
   

- Advertisement -