Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- import platform
- import datetime
- def creation_date(path_to_file):
- if platform.system() == 'Windows':
- return os.path.getctime(path_to_file)
- else:
- stat = os.stat(path_to_file)
- try:
- return stat.st_birthtime
- except AttributeError:
- return stat.st_mtime
- def unix_time_to_readable(ctime, format="'%Y-%m-%d %H:%M:%S'"):
- return datetime.datetime.fromtimestamp(int(ctime)).strftime(format)
Add Comment
Please, Sign In to add comment