How do I get datetime to stop showing seconds?

Cousin Stanley cousinstanley at gmail.com
Fri Oct 16 10:23:58 EDT 2020


Steve wrote:

> d2 =  datetime.datetime.now() #Time Right now
> 
> Show this: 2020-10-16 02:53
> and not this: 2020-10-16 02:53:48.585865
> 
> 
> ==============================================================
> Footnote:
> If you double major in psychology and reverse psychology, to they cancel
> each other out?
> 
> --

py> 
py> import datetime as dt
py> 
py> d = dt.datetime.now().strftime( '%Y-%m-%d  %H:%M' )
py> 
py> print( '\n  ' , d )

   2020-10-16  07:22


-- 
Stanley C. Kitching
Human Being
Phoenix, Arizona



More information about the Python-list mailing list