xxxxxxxxxx
# Convert timestamps from GMT to UTC
for row in data:
if 'progress_updated_at' in row: # Assuming the timestamp key is 'progress_updated_at'
gmt_timestamp = str(row['progress_updated_at'])
gmt_datetime = datetime.strptime(gmt_timestamp, '%Y-%m-%d %H:%M:%S')
utc_datetime = gmt_datetime.replace(tzinfo=pytz.timezone('GMT')).astimezone(pytz.UTC)
row['progress_updated_at'] = utc_datetime.strftime('%Y-%m-%dT%H:%M:%SZ')
xxxxxxxxxx
def convertTiming(date):
if '.' in date:
dateformat = "%Y-%m-%d %H:%M:%S.%f"
else:
dateformat = "%Y-%m-%d %H:%M:%S"
dt_utc = datetime.strptime(date, dateformat)
dt_utc = dt_utc.replace(tzinfo=pytz.UTC)
local_zone = tz.tzlocal()
dt_local = dt_utc.astimezone(local_zone)
return dt_local.strftime(dateformat)