I have a datetime in a mssql database.

When I do

date = system.db.runScalarQuery(‘QueryForDate’)

How do I subtract one minute from date?

I can do date.month += 1, but not date.minute +=1

It appears to be a java Date, but none of the info on the internet seems to work.



You’ll want to use the SQL Server Function DATEADD() to manipulate the datetime within the query itself:

Here’s an example of adding one minute to a datetime value stored in the column “t_stamp”:

date = system.db.runScalarQuery("SELECT DATEADD(minute,1,t_stamp) from test_table where id=1")