Skip to content

change convert_timestamps_to_str #268

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions application/utils/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import logging
import time
import random
from datetime import datetime
import datetime
from multiprocessing import Manager

import pandas as pd
Expand Down Expand Up @@ -34,7 +34,7 @@ def generate_log_id():


def get_current_time():
now = datetime.now()
now = datetime.datetime.now()
formatted_time = now.strftime('%Y-%m-%d %H:%M:%S')
return formatted_time

Expand Down Expand Up @@ -66,6 +66,9 @@ def convert_timestamps_to_str(data):
if isinstance(item, pd.Timestamp):
# Convert Timestamp to string
new_row.append(item.strftime('%Y-%m-%d %H:%M:%S'))
elif isinstance(item, datetime.date):
# Convert datetime.date to string
new_row.append(item.strftime('%Y-%m-%d %H:%M:%S'))
else:
new_row.append(item)
converted_data.append(new_row)
Expand Down