Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #/usr/bin/python
- # https://www.facebook.com/groups/python.ar.community/
- date = raw_input('Entrer un date sous la forme jj/mm/aaaa : ')
- jj = int(date[:2]) # prendre le jour
- mm = int(date[3:5]) # prendre le mm
- aaaa = int(date[6:]) # prendre l'aaaa
- if mm == 1 or mm == 3 or mm == 5 or mm == 7 or mm == 8 or mm == 10 or mm == 12: nbj = 31
- elif mm == 4 or mm == 6 or mm == 9 or mm == 11 : nbj = 30
- elif mm == 2 :
- bis = (aaaa % 4 == 0) and (aaaa % 100 != 0) or (aaaa % 400 == 0) # voir si l'anne est bissextile
- if bis == True: nbj = 29
- else : nbj = 28
- if jj != nbj : jj += 1
- elif mm == 12 :
- jj = 01
- mm = 01
- aaaa += 1
- else :
- jj = 1
- mm += 1
- jj = str(jj) ; mm = str(mm) ; aaaa = str(aaaa)
- if len(jj) == 1 : jj = '0' + jj
- if len(mm) == 1 : mm = '0' + mm
- print '\n'+jj+'/'+mm+'/'+aaaa
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement