Python - Padding Single Digits In Dates
Python - Padding Single Digits In Dates
Submitted by Corey Goldberg on Mon, 03/03/2008 - 20:52.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
