Scarthia
Scarthia

Reputation: 17

How to takeaway seconds to time.strftime in python 2.7?

I want to use this time format that I have:

time.strftime("%Y_%m_%d_%H_%M_%S")

So, if I were to print it, it would look like this:

2015_11_20_15_28_03

And I was wondering how I could takeaway seconds from it. I've only had luck with finding how to add hours and minutes, which don't work for seconds.

Upvotes: 0

Views: 160

Answers (1)

TigerhawkT3
TigerhawkT3

Reputation: 49330

Simply exclude the %S, which represents seconds, if you don't want it.

time.strftime("%Y_%m_%d_%H_%M")

Upvotes: 6

Related Questions