Commit 3e377690 authored by Kristian Tan's avatar Kristian Tan

Formatted dates

parent ed17e334
...@@ -75,7 +75,9 @@ def toggle_pin(change_pin): ...@@ -75,7 +75,9 @@ def toggle_pin(change_pin):
if GPIO.input(change_pin) == 0: if GPIO.input(change_pin) == 0:
message += " off." message += " off."
uptime = datetime.now() - pins[change_pin]['on_time'] uptime = datetime.now() - pins[change_pin]['on_time']
d = DailyUsage(date=pins[change_pin]['on_time'], hours=uptime) uptime = datetime.strptime(uptime, '%b %d %Y %I:%M%p')
date = datetime.strptime(pins[change_pin]['on_time'], '%b %d %Y %I:%M%p')
d = DailyUsage(date=date, hours=uptime)
db.session.add(d) db.session.add(d)
db.session.commit() db.session.commit()
pins[change_pin]['on_time'] = None pins[change_pin]['on_time'] = None
......
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