X-Git-Url: https://git.immae.eu/?p=perso%2FDenise%2Foms.git;a=blobdiff_plain;f=gestion_donnees.py;h=82491ca606b168a12606f4bc1423784e9c6f7e2f;hp=2177fc8ae9e3f8c3f26b375c40aab5ae84860d78;hb=9cb3c31c54b868e0c3a335ef3a4b4cdc81e479fb;hpb=d38793f9260c1ca8b96a049d04cc801413c8fb0e diff --git a/gestion_donnees.py b/gestion_donnees.py index 2177fc8..82491ca 100644 --- a/gestion_donnees.py +++ b/gestion_donnees.py @@ -53,7 +53,7 @@ def convertit_age_vers_texte(nombre): annees = int(nombre / jours_dans_annee) restant = nombre - round(annees*jours_dans_annee) mois = int(restant/jours_dans_mois) - jours= restant - round(mois*jours_dans_mois) + jours= nombre - round(mois*jours_dans_mois + annees*jours_dans_annee) chaine = "" if annees >0: @@ -97,7 +97,12 @@ def convertit_date_vers_python(chaine,liste_err): warning("La date : "+chaine+" est invalide !",liste_err) return "" else: - return datetime.date(int(liste[0]),int(liste[1]),int(liste[2])) + try: + date = datetime.date(int(liste[0]),int(liste[1]),int(liste[2])) + except: + date = "" + warning("Impossible de lire la date "+chaine) + return date def convertit_date_vers_texte(date): """ convertit une date python en format texte aaaa-mm-jj"""