Commit 93a529e0 authored by Kristian Tan's avatar Kristian Tan

Format date for db

parent a3474ad6
...@@ -74,7 +74,7 @@ def toggle_pin(change_pin): ...@@ -74,7 +74,7 @@ def toggle_pin(change_pin):
if pins[change_pin]['on_time'] is not None: if pins[change_pin]['on_time'] is not None:
start_time = pins[change_pin]['on_time'] start_time = pins[change_pin]['on_time']
elapsed = str(datetime.now() - start_time) elapsed = str(datetime.now() - start_time)
start_date = datetime.strftime(start_time, '%Y-%m-%d').date() start_date = datetime.strftime(start_time, '%Y-%m-%d')
entry = DailyUsage(date=start_date, on_time=elapsed) entry = DailyUsage(date=start_date, on_time=elapsed)
db.session.add(entry) db.session.add(entry)
db.session.commit() db.session.commit()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment