wetter/wetter/utils.py

13 lines
249 B
Python
Raw Normal View History

2020-04-07 14:02:29 +02:00
#!/usr/bin/env python3
from datetime import datetime
def fromisoformat(str):
return datetime.strptime(str, '%Y-%m-%d').date()
2020-04-08 17:50:25 +02:00
def toisoformat(str, alt=""):
try:
return fromisoformat(str).isoformat()
except:
return alt