[Python-ideas] Provide __main__ for datetime and time

Michel Desmoulin desmoulinmichel at gmail.com
Fri Apr 1 14:02:10 EDT 2016

As with my previous email about __main__ for random, uuid and os, I wish
to suggest a similar __main__ for datetime. The target audience may not
be the same, so I'm making it a difference proposal.


python -m datetime now => print(str(datetime.datetime.now())
python -m datetime utcnow => print(str(datetime.datetime.utcnow())
python -m time epoch => print(time.time())

python -m datetime now "%d/%m/%Y" =>
python -m datetime utcnow "%d/%m/%Y" =>

More information about the Python-ideas mailing list