Could somebody recommend a small utility to calculate the number of days between two dates?

andrew clarke mail at ozzmosis.com
Sun Jan 31 20:42:11 UTC 2010


On Sun 2010-01-31 11:46:18 UTC-0600, Peng Yu (pengyu.ut at gmail.com) wrote:

> Could somebody let me what tool I can use to calculate the number of
> days before two dates in ubuntu?

You could use Python...

7:40 ozzmosis at prime [~/src]cat datediff.py 
#!/usr/bin/env python

import datetime

dateA = datetime.datetime(2010, 2, 1)
dateB = datetime.datetime(1987, 8, 30)

print dateA - dateB

7:40 ozzmosis at prime [~/src]python datediff.py 
8191 days, 0:00:00




More information about the ubuntu-users mailing list