# Function Calendar.add not working

**URL:** <https://forum.inductiveautomation.com/t/function-calendar-add-not-working/7882>\
**Category:** Ignition\
**Created:** [January 21, 2014, 5:00pm UTC](https://forum.inductiveautomation.com/t/function-calendar-add-not-working/7882 "2014-01-21T17:00:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![domi](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@domi](https://forum.inductiveautomation.com/u/domi)\
**Post date:** [January 21, 2014, 5:00pm UTC](https://forum.inductiveautomation.com/t/function-calendar-add-not-working/7882/1 "2014-01-21T17:00:50Z")

</div>

Try this :

`from java.util import Calendar
timenow = Calendar.getInstance()
print "Before : ", timenow
timenow.add( Calendar.SECOND, 10)
print "After :", timenow
`

Result : No change in date…

Lost one day on this one…

---

<div class="post-metadata">

**Author:** ![cire3621](https://avatars.discourse-cdn.com/v4/letter/c/f08c70/32.png) [@cire3621](https://forum.inductiveautomation.com/u/cire3621)\
**Post date:** [January 21, 2014, 5:13pm UTC](https://forum.inductiveautomation.com/t/function-calendar-add-not-working/7882/2 "2014-01-21T17:13:41Z")

</div>

I put this in the script playground and the after time changed…

`from java.util import Calendar
timenow = Calendar.getInstance()
print "Before : ", timenow
timenow.add(Calendar.SECOND,10)
print "After :", timenow`

What are you trying to change? Cause that code will add 10 seconds…

---

<div class="post-metadata">

**Author:** ![Duffanator](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/duffanator/32/3560_2.png) [@Duffanator](https://forum.inductiveautomation.com/u/Duffanator)\
**Post date:** [January 21, 2014, 8:02pm UTC](https://forum.inductiveautomation.com/t/function-calendar-add-not-working/7882/3 "2014-01-21T20:02:09Z")

</div>

I’m pretty sure that you have to use the getTime() method to return the actual time values:

`from java.util import Calendar
timenow = Calendar.getInstance()
print "Before : ", timenow.getTime()
timenow.add(Calendar.SECOND,10)
print "After :", timenow.getTime()`

---

<div class="post-metadata">

**Author:** ![cire3621](https://avatars.discourse-cdn.com/v4/letter/c/f08c70/32.png) [@cire3621](https://forum.inductiveautomation.com/u/cire3621)\
**Post date:** [January 21, 2014, 8:11pm UTC](https://forum.inductiveautomation.com/t/function-calendar-add-not-working/7882/4 "2014-01-21T20:11:15Z")

</div>

Duff is right you do…

Time was changing, just not returning…just was not sure if he was wanting the time or date to change, cause he said date was not changing…but time was still going up 10 seconds…just not returning.
