""" * My CheatSheet for.. The Python Datetime Module * YouTube Channel: Python Simplified * Vid: The Ultimate Guide To Datetime! Datetime Docs... URL: strftime() + strptime() Docs... URL: https://docs.python.org/3/library/datetime.html#strftime-and-strptime-format-codes """ from datetime import date # Create A Date Object today = date.today() print('Today is: ', today) # Today is: 2023-12-31 print() # Get Parts Of the Date Object print('Day: ', today.day) print('Day: ', today.month) print('Day: ', today.year) print() # strftime() my_format_01 = today.strftime('%A %d %B %Y') print('my_format_01:\n', my_format_01) print() # Make my own Date Object my_B_day = date(1971, 1, 14) print('Normal Date Object: My B/Day Is..\n', my_B_day) # My B/Day Is.. 1971-01-14 print() #? ===== THIS IS WHAT I NEED FOR PySimpleGUI Calendar Output ===== # Make my own Date Object (AS A String!!) my_B_day_ISO = date.fromisoformat('1971-01-14') print('Date from a *String* Using ISO Format\n', my_B_day_ISO) print() #? ===== THIS WORKS!!! ===== # Reformat fromisoformat my_format_ISO_01 = my_B_day_ISO.strftime('%A %d %B %Y') my_format_ISO_02 = my_B_day_ISO.strftime('%d %b %Y') # This WORKS!! print('my_format_ISO_01:\n', my_format_ISO_01) # Thursday 14 January 1971 print() print('my_format_ISO_01:\n', my_format_ISO_02) # 14 Jan 1971 print()