user defined date

Discussion created by kimt12 on May 18, 2012
Latest reply on May 22, 2012 by kimt12
The following script (from ArcGIS 10 help) uses time settings (start time, end time, and time interval) published in an existing map document to export a series of images:

import arcpy, datetime
mxd = arcpy.mapping.MapDocument(r"C:\Project\Project.mxd")
df = arcpy.mapping.ListDataFrames(mxd, "Traffic Analysis")[0]
df.time.currentTime = datetime.datetime(2008, 10, 1)
endTime = datetime.datetime(2008, 10, 31)
interval = datetime.timedelta(days=7)
while df.time.currentTime <= endTime:
    #An example str(newTime) would be: "2008-01-29 02:19:59"
    #The following line splits the string at the space and takes the first
    #  item in the resulting string. 
    fileName = str(df.time.currentTime).split(" ")[0] + ".png"
    arcpy.mapping.ExportToPNG(mxd, r"C:\Project\Output\\" + fileName, df)
    df.time.currentTime = df.time.currentTime + interval
del mxd

I am using this script in modelbuilder in such a way that user can define the end time. But I don???t know how to change this part of the code, how I define ???end Time??? to get date from user dialoge instead of:
endTime = datetime.datetime(2008, 10, 31)

I am new in python, any help is appreciated.