# Dates

**URL:** <https://forum.inductiveautomation.com/t/dates/5917>\
**Category:** Ignition\
**Created:** [February 22, 2013, 9:06pm UTC](https://forum.inductiveautomation.com/t/dates/5917 "2013-02-22T21:06:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikehill100](https://avatars.discourse-cdn.com/v4/letter/m/bcef8e/32.png) [@mikehill100](https://forum.inductiveautomation.com/u/mikehill100)\
**Post date:** [February 22, 2013, 9:06pm UTC](https://forum.inductiveautomation.com/t/dates/5917/1 "2013-02-22T21:06:24Z")

</div>

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.

Thanks,

Mike

---

<div class="post-metadata">

**Author:** ![James.Lorenz](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/james.lorenz/32/3290_2.png) [@James.Lorenz](https://forum.inductiveautomation.com/u/James.Lorenz)\
**Post date:** [February 22, 2013, 9:36pm UTC](https://forum.inductiveautomation.com/t/dates/5917/2 "2013-02-22T21:36:47Z")

</div>

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

[w3schools.com/sql/func\_dateadd.asp](http://www.w3schools.com/sql/func_dateadd.asp)

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

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