I have a date field that contains date/time in the format DD:MM:YYYY HH:MM:SS. I want to be able to calculate the week number based on these dates in a seperate column using Python in ArcGIS Pro. I am able to get the week number based on the current date using the following code:
datetime.date.today().strftime("%W")
Unfortunately I can't translate this into pulling the week number from a separate column, rather than the current date.
Best Answer
You can use the UpdateCursor to read the date field and update the week field:
The code can be executed in the Python window. You need to change the name of the feature class and fields to match your data:
Screenshot from ArcMap but it is the same in Pro: