Back to Project List

dtcalc

A command line tool written in Python to find the difference between dates. (Project was originally titled dtdiff.)

Repository Video ▶️

Calculate difference between dates using a command line tool making use of small notations in the style of format specifiers.

Packaged. Install with pip install dtcalc.

Example usages

$ dtcalc "3d - (2021-11-04 - 2021-11-06)" --in-dtfmt "%Y-%m-%d"
5 days

$ dtcalc "3d - (2021-11-04 11:30 - 2021-11-04 10:30)" --in-dtfmt "%Y-%m-%d %H:%M"
2 days, 23 hours

$ dtcalc --out-dtfmt "%B %d, %Y" "2021/04/11 + 22w"
September 12, 2021

$ dtcalc --out-dtfmt "%B %d, %Y" "2021/04/11 - 2020/11/12 +2d + 3w + 4h + 2m"
24 weeks, 5 days, 4 hours, 2 minutes

See https://github.com/ju-sh/dtcalc/blob/master/README.md

Features

  • Self-contained. No dependencies other than a recent Python implementation.
  • Packaged and made available from PyPI
  • Maintainable code:
    • Unit tested with good test coverage
    • CI/CD via github actions
    • Static type checked
    • Linted
    • Dead code elimination checks.
    • Well commented source code.
Julin Shaji

Packaged as dtcalc. Installable with pip install dtcalc.

November 14, 2021

Project created by Julin Shaji

November 6, 2021