datetime.strptime() not padding 0's

R

Rodrick Brown

I thought I read some where that strptime() will pad 0's for day's for some
reason this isnt working for me and I'm wondering if i'm doing something
wrong.

How can I get strptime to run 09? instead of 9


--RB
 
J

John Gordon

In said:
I thought I read some where that strptime() will pad 0's for day's for some
reason this isnt working for me and I'm wondering if i'm doing something
wrong.

How can I get strptime to run 09? instead of 9

dt.day is just an integer. If you want to print it with zero padding,
use a format string:
09

or for python 3:09
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,120
Latest member
ShelaWalli
Top