Commit 21dba144 authored by Kristian Tan's avatar Kristian Tan

Format date for db

parent 05c586c2
......@@ -72,10 +72,10 @@ def toggle_pin(change_pin):
if GPIO.input(change_pin) == 0:
message += " off."
if pins[change_pin]['on_time'] is not None:
start_time = str(pins[change_pin]['on_time'])
start_time = pins[change_pin]['on_time']
elapsed = str(datetime.now() - start_time)
date = datetime.strptime(start_time, '%Y-%m-%d').date()
entry = DailyUsage(date=date, on_time=elapsed)
start_date = datetime.strptime(str(start_time), '%Y-%m-%d').date()
entry = DailyUsage(date=start_date, on_time=elapsed)
db.session.add(entry)
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