Skip to content

Commit 8f11884

Browse files
authored
Merge pull request #268 from aws-samples/v1.5.1_dev
change convert_timestamps_to_str
2 parents 6d88581 + 6e38678 commit 8f11884

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

application/utils/tool.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import logging
33
import time
44
import random
5-
from datetime import datetime
5+
import datetime
66
from multiprocessing import Manager
77

88
import pandas as pd
@@ -34,7 +34,7 @@ def generate_log_id():
3434

3535

3636
def get_current_time():
37-
now = datetime.now()
37+
now = datetime.datetime.now()
3838
formatted_time = now.strftime('%Y-%m-%d %H:%M:%S')
3939
return formatted_time
4040

@@ -66,6 +66,9 @@ def convert_timestamps_to_str(data):
6666
if isinstance(item, pd.Timestamp):
6767
# Convert Timestamp to string
6868
new_row.append(item.strftime('%Y-%m-%d %H:%M:%S'))
69+
elif isinstance(item, datetime.date):
70+
# Convert datetime.date to string
71+
new_row.append(item.strftime('%Y-%m-%d %H:%M:%S'))
6972
else:
7073
new_row.append(item)
7174
converted_data.append(new_row)

0 commit comments

Comments
 (0)