Take the 2-minute tour ×  now() gives me
datetime.datetime(2010, 7, 6, 5, 27, 23, 662390)  How do I get
just datetime.datetime(2010, 7, 6, 5, 27, 0, 0) (the datetime
object) where everything after minutes is zero?  share|improve
this question add comment  3 Answers  up vote 21 down vote
accepted dt.replace( second=0, microsecond=0)   share|improve
this answer Note that this is just a value and does not alter dt
- if that's what you want then also assign it back to dt. – 
John Mee Jun 30 '11 at 4:00 add comment  You can use
datetime.replace to obtain a new datetime object without the
seconds and microseconds:  the_time = datetime.now() the_time =
the_time.replace(second=0, microsecond=0) share|improve this
answer or the_time= datetime.now().replace(second=0,
microsecond=0) –  tzot Aug 4 '10 at 11:05 add comment  I know
it's quite old question, but I haven't found around any really
complete answer so far.  There's no need to create a datetime
object first and subsequently manipulate it.  dt =
datetime.now().re