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…
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…
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…
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()
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.