DeaD_EyE

date formatting

Aug 18th, 2019
104
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import datetime
  2.  
  3. date = datetime.date(2019, 8, 1)
  4.  
  5.  
  6. print(date.strftime('%b %-d, %Y'))
  7. # format string is not always better
  8. print(f'{date:%b} {date:%-d}, {date:%Y}')
RAW Paste Data