Here is how to zero-pad single digit days or months in a date string:
date = '3/2/2008' padded_date = time.strftime('%m/%d/%Y', time.strptime(date,'%m/%d/%Y')) print padded_date
>> 03/02/2008
Copyright © 2006-2008 Corey Goldberg
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.