Download filetime.py from 1earner1/llm_for_Code: direct link, hf CLI and curl.
- Browser
- Download file 643 Bytes
-
https://huggingface.co/1earner1/llm_for_Code/resolve/main/filetime.py
- Command line
-
hf download hf://1earner1/llm_for_Code/filetime.py
-
curl -L -o filetime.py https://huggingface.co/1earner1/llm_for_Code/resolve/main/filetime.py
643 Bytes
| 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)) | |