thanks for answer. but in this script just one date or time is given to be automated. my problem is bit complicated. i have two columns in my attribute table (Start_time, Total_time). another blank column with alis Finish_Time. I want to add these two to get finish_time column automated. remember the total time is in hours format not in date format. e.g.. Start_time+Total_time = finish_time
import arcpy import datetime import timedelta fc = r"H:\Documents\ArcGIS\Default.gdb\TimeDelta" cursor = arcpy.UpdateCursor(fc) for row in cursor: startdate = row.Start_time totaltime = row.Total_time upddate = datetime.timedelta(hours = totaltime) later = startdate + upddate row.setValue("finish_time", later) cursor.updateRow(row)
dear members here i have been asked. what is the total time.here total time is numer of hours
new_datestr = later.strftime("%m/%d/%Y %H:%M")
import arcpy import datetime import timedelta d1 = '3/4/2013 10:23' d1frmt = datetime.datetime.strptime(d1, "%m/%d/%Y %H:%M") addhours = 36 dt = datetime.timedelta(hours = addhours) later = d1frmt + dt arcpy.AddMessage(str(later))
hello everyone.i am using arcgis 10 and now a days working on network analyst. i got struck in a problem. network analyst is good to calculate the final date for a route on the basis of timewindow start. but my application got a formula that calculates some additional hours for a defined route. i have created a attribute table where i import the start date and then a blank column for final date which i want to populate with a python scripts that adding start date plus no hours gives the results.e.g3/4/2013 10:23 AM + 36:00 hr = final date with timeany vb python script would be a good one forTHANKS
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.