| import os | |
| import platform | |
| import datetime | |
| def get_creation_date(path): | |
| # if platform.system() == 'Windows': | |
| # return datetime.datetime.fromtimestamp(os.path.getctime(path)) | |
| # else: | |
| # # On Linux/Unix, return last metadata change time | |
| stat = os.stat(path) | |
| print(stat) | |
| # try: | |
| # return datetime.datetime.fromtimestamp(stat.st_birthtime) # macOS | |
| # except AttributeError: | |
| # Linux fallback | |
| return datetime.datetime.fromtimestamp(stat.st_ctime) | |
| # Example | |
| file_path = "run_lora_chat.py" | |
| print("Creation time:", get_creation_date(file_path)) | |