uso del config file

This commit is contained in:
2020-04-15 20:37:39 +02:00
parent 0238f51ab9
commit a9d29314dc
3 changed files with 27 additions and 5 deletions

View File

@@ -0,0 +1,14 @@
"""Funzioni per formato data
"""
import datetime
def dateFmt(date):
t = date.replace("/","-")
try:
datetime.datetime.strptime(t, '%Y-%m-%d')
return t
except ValueError:
d = datetime.datetime.strptime(t, '%d-%m-%Y')
return datetime.datetime.strftime(d, "%Y-%m-%d")