My Python script is currently writing out my date from the timedate
module request as follows:
2019-08-28 14:56:52.559047
I want it to be converted to:
Aug 28
My Python script is currently writing out my date from the timedate
module request as follows:
2019-08-28 14:56:52.559047
I want it to be converted to:
Aug 28
You can use the datetime
module.
>>> import datetime
>>> now = datetime.datetime.now()
>>> now.strftime("%b %d")
'Aug 28'
I'd suggest reading about the datetime module (official docs) and strftime.
Relevant SO question: How to print a date in a regular format?