Dates in Python
datetimetools
A collection of tools for date and time calculations. Here is a link to the repository. For a quick reference to date and time in python, check this link.
Programs
1. deadlines.py
This script is to keep track of the number of days and business days between today and a future date. Takes input from a csv file ‘deadlines.csv’.
Input: deadlines.csv
date description notes
2018-02-11 trip
2018-05-29 championship kick ass
Output:
$ python deadlines.py
3 days remaining until trip
= 2 business days, minus holidays
110 days remaining until championship
= 79 business days, minus holidays
... kick ass
2. daysdelta.py
Number of days between today and a future date. Takes input from keyboard.
$ python daysdelta.py
This program calculates number of days to a future date
For the future date, enter
year (yyyy): 2018
month (m): 8
Enter day (d): 1
175
3. plusdays.py
Determines the future date after n days.
$ python plusdays.py
Finds the future date after n days from today
n=?100
2018-05-18 12:47:35.102163
4. plusbusinessdays.py
Determines the future date after n business days.
$ python plusbusinessdays.py
Finds the future date after n businessdays from today
n=?100
2018-06-28 12:48:19.891332
not counting holidays
5. datefixer.py
Imports CSV file, converts the dates in two columns from yyyy/mm/dd to mm/dd/yyyy.
:pizza: