Included created_at() function

This commit is contained in:
2024-04-24 17:16:59 +02:00
parent 508266132e
commit cf2431d4c3

View File

@ -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])
@ -66,3 +67,15 @@ def make_file_copy(source_file_path, output_folder_name : str = 'tmp_files'):
shutil.copy(source_file_path, tmp_file_path)
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