from pathlib import Path
test = '/Library/Mobile Documents/iCloud~com~openplanetsoftware~just-press-record/Documents/2022-05-26/01-27-19.m4a'
path_parts = Path(test).parts
parent_folder_name = path_parts[-2]
print(parent_folder_name)
print(type(parent_folder_name))
outputs:
2022-05-26
<class 'str'>