T
tertius
Hi,
Is there a more pythonic way to write or do a date difference
calculation? I have as input two date fields in the form 'YYYY-MM-DD'
TIA
Terius
from datetime import date
bdl = '2004-11-25'.split('-')
edl = '2004-11-30'.split('-')
bd = date(int(bdl[0]), int(bdl[1]), int(bdl[2]))
ed = date(int(edl[0]), int(edl[1]), int(edl[2]))
print ed , '-', bd , '=', (ed-bd).days
Is there a more pythonic way to write or do a date difference
calculation? I have as input two date fields in the form 'YYYY-MM-DD'
TIA
Terius
from datetime import date
bdl = '2004-11-25'.split('-')
edl = '2004-11-30'.split('-')
bd = date(int(bdl[0]), int(bdl[1]), int(bdl[2]))
ed = date(int(edl[0]), int(edl[1]), int(edl[2]))
print ed , '-', bd , '=', (ed-bd).days