AnsweredAssumed Answered

Get YYYYMMDD String from Date

Question asked by jonmulder on Dec 22, 2013
Latest reply on Dec 23, 2013 by jonmulder
I have a script where the user enters a StartDate and EndDate (via arcpy.GetParameterAsText dialog boxes).

I want to return strings of those dates in a "YYYYMMDD" format.  In another script, I used a snippet to loop through the dates and return a string (CurrentDate) in YYYYMMDD format, but I really don't understand how that function works.

Thanks for any help,

Jon Mulder

import arcpy  from datetime import date from dateutil.rrule import rrule, DAILY import time  StartDate = arcpy.GetParameterAsText(0) EndDate = arcpy.GetParameterAsText(0) print StartDate strStartDate = "YYYYMMDD"          #How do I get this format?   for dt in rrule(DAILY, dtstart=DateStart, until=DateEnd):     CurrentDate = dt.strftime("%Y%m%d")  print "Done."