"""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")