""" * My CheatSheet for.. The Python Datetime Module * YouTube Channel: Python Simplified * Vid: The Ultimate Guide To Datetime! * Vid URL: https://www.youtube.com/watch?v=-AlFiS74aQg 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() """ * From: Info 4 Plex and Kodi - Alvarez vs Bivol.md (Actual File) # Plex & Kodi: Dates Format.. - Date: 7th/May/2022 - Studio: Fight Date: 2022-May-07 - [FOR PLEX] + MetaX - Tagline: Fight Date: 7th/May/2022 - [FOR KODI] # Fight Folder Name.. - Canelo Alvarez vs Dmitry Bivol (7th-May-2022) """ #? ===== How I'm gonna use it in my code ===== # String from the calendar selected_cal_fight_date = '2023-02-14' # Make a date Object using ISO Format fight_date_ISO = date.fromisoformat(selected_cal_fight_date) # Reformat fromisoformat # Fight Date: 2023-02-14 | [FOR PLEX: OG Available Date] OG_ISO_format = fight_date_ISO.strftime('%Y-%m-%d') # This WORKS!! # Tagline: Fight Date: 7th/May/2022 - [FOR KODI] # Fight Date: 28th/Jan/2023 (ACTUAL REQ FORMAT!!) kodi_ISO_format = fight_date_ISO.strftime('%dth/%b/%Y') # This WORKS!! # Studio: Fight Date: 2022-May-07 - [FOR PLEX] + MetaX (OLD) # Fight Date: 28th/Jan/2023 (ACTUAL REQ FORMAT!!) plex_ISO_format = fight_date_ISO.strftime('%dth/%b/%Y') # This WORKS!! # Fight Folder Name: Canelo vs Bivol (7th-May-2022) folder_ISO_format = fight_date_ISO.strftime('(%dth-%b-%Y)') # This WORKS!! print() print('=================================================') print('=========== Kodi, Plex & Folder Dates =========== ') print('================ From ISO Format ================ ') print('[FOR PLEX] OG Available Date:\n', OG_ISO_format) # Thursday 14 January 1971 print() print('[FOR KODI] Tagline: Fight Date:\n', kodi_ISO_format) # 14 Jan 1971 print() print('[FOR PLEX] + MetaX | Studio Fight Date:\n', plex_ISO_format) # 14 Jan 1971 print() print('Fight Folder Name:\n', folder_ISO_format) # 14 Jan 1971 print('=================================================') print()