From cf2431d4c339422ef1ba45fbdfaa3abe10b14bad Mon Sep 17 00:00:00 2001 From: Florez Ospina Juan Felipe Date: Wed, 24 Apr 2024 17:16:59 +0200 Subject: [PATCH] Included created_at() function --- src/g5505_utils.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/g5505_utils.py b/src/g5505_utils.py index b126046..ce4ce46 100644 --- a/src/g5505_utils.py +++ b/src/g5505_utils.py @@ -1,6 +1,7 @@ import pandas as pd import os import shutil +import datetime def is_callable_list(x : list): return all([callable(item) for item in x]) @@ -65,4 +66,16 @@ def make_file_copy(source_file_path, output_folder_name : str = 'tmp_files'): tmp_file_path = os.path.join(tmp_dirpath,backup_filename) shutil.copy(source_file_path, tmp_file_path) - return tmp_file_path \ No newline at end of file + return tmp_file_path + +def created_at(): + + now = datetime.now() + # Populate now object with time zone infotmation obtained from the local system + now_tz_aware = now.astimezone() + tz = now_tz_aware.strftime('%z') + #created_at = now_tz_aware.strftime('%Y-%m-%d_%H-%M-%S')+'_utcoffset_' + tz + created_at = now_tz_aware.strftime('%Y-%m-%d')+'_UTC-OFST_' + tz + # Make created at timestamp with tz information + #created_at = now.isoformat() + return created_at \ No newline at end of file