Reputation: 1
How can I change the time without turning it into a string object (which dt.strftime does)? Like if I want to turn (default time format and time object)%H:%M:%S into %I:%M:%S %p or turn %H:%M:99(Default under time column in csv file data) into %H:%M:00?
Strftime helps resolve the problem, but it also results in data conversion (from datetime format to a string format) as per my instructor.
Upvotes: 0
Views: 59
Reputation: 12140
Changing 59 seconds to 00 seconds is changing the value of seconds
, for this use .replace(seconds=0)
.
Changing the 24-hour clock to a 12-hour clock with am/pm is not a time
object property, it's only a display format (when converting time
to a string).
Upvotes: 0