Select to view content in your preferred language

Add 1-day to today()

482
2
Jump to solution
10-16-2023 12:30 AM
Labels (1)
JeffHouser
Occasional Contributor

Hello,

I'm using ArcGIS Desktop.  I'm trying to update a date field in a featureclass using the following code: 

rows.updateRow((datetime.date.today() + datetime.timedelta(days=+1)))

I'm just trying to add 1-day to today().  The above code is triggering a TypeError: argument must be sequence of values. Seems I may be using timedelta wrong?  Maybe there is a better way?

-Jeff

0 Kudos
1 Solution

Accepted Solutions
JeffHouser
Occasional Contributor

Thank you Dan for you your reply.  I was already using your #4 example.  Looks like I had a paranthesis issue in my code. What I found out, I needed to change the code:

from
rows.updateRow((datetime.date.today() + datetime.timedelta(days=+1)))
to
rows.updateRow([datetime.date.today() + datetime.timedelta(days=1)])

Thank You

-Jeff

View solution in original post

0 Kudos
2 Replies
DanPatterson
MVP Esteemed Contributor

As an example...

datetime.date.today()
datetime.date(2023, 10, 16)

datetime.date.today() + datetime.timedelta(days=10)
datetime.date(2023, 10, 26)

... sort of retired...
0 Kudos
JeffHouser
Occasional Contributor

Thank you Dan for you your reply.  I was already using your #4 example.  Looks like I had a paranthesis issue in my code. What I found out, I needed to change the code:

from
rows.updateRow((datetime.date.today() + datetime.timedelta(days=+1)))
to
rows.updateRow([datetime.date.today() + datetime.timedelta(days=1)])

Thank You

-Jeff

0 Kudos