pdd
pdd (Python3 Date Diff) is a tiny command line utility to calculate date and time difference. It can also be used as a timer. If no program arguments are specified it shows the current date, time and timezone.
pdd has been written with only one goal - simplicity. Users shouldn't have to memorize anything.
Table of Contents
- Features
- Installation
- Dependencies
- From a package manager
- Release packages
- From source
- Running standalone
- Usage
- cmdline options
- Operational notes
- Examples
- Copyright
Features
- easy to use, minimal dependencies
- calculate date and time difference
- calculate diff from today and now
- add, subtract duration (timeslice) to/from date (time)
- countdown timer with command piggybacking
- custom resolution stopwatch
- non-verbose mode for background timers
- show current date, time and timezone
- follows ISO 8601
Installation
Dependencies
pdd requires Python 3.8 (or later) and the dateutil module.
To install dateutil on Ubuntu, run:
$ sudo apt-get install python3-dateutil
or, using pip3:
$ sudo pip3 install python-dateutil
From a package manager
Install pdd from your package manager. If the version available is dated try an alternative installation method.
Release packages
Packages for Arch Linux, CentOS, Debian, Fedora and Ubuntu are available with the latest stable release.
From source
If you have git installed, clone this repository. Otherwise download the latest latest stable release or development version (risky).
Install to default location (/usr/local):
$ sudo make install
To remove, run:
$ sudo make uninstall
PREFIX is supported, in case you want to install to a different location.
Running standalone
pdd is a standalone utility. From the containing directory, run:
$ chmod +x pdd
$ ./pdd
Usage
cmdline options
usage: pdd [-h] [-d yyyy mmm dd [yyyy mmm dd | y m d]]
[-t hh:mm:ss [hh:mm:ss | h:m:s]] [--add] [--sub]
[--day yyyy mmm dd] [-c hh:mm:ss] [-r command] [-s [resolution]] [-q] [-v]
[keywords ...]
Tiny date, time difference calculator with timers.
positional arguments:
keywords diff/add/subtract from today or now
options:
-h, --help show this help message and exit
-d yyyy mmm dd [yyyy mmm dd | y m d], --date yyyy mmm dd [yyyy mmm dd | y m d]
calculate date difference
-t hh:mm:ss [hh:mm:ss | h:m:s], --time hh:mm:ss [hh:mm:ss | h:m:s]
calculate time difference
--add add to date (/today) or time (/now)
--sub subtract from date (/today) or time (/now)
--day yyyy mmm dd show day of the week on a date
-c hh:mm:ss, --timer hh:mm:ss
start a countdown timer
-r command, --run command
run command when countdown timer reaches 0
-s [resolution], --stopwatch [resolution]
start a stopwatch [default resolution: 3 (ms)]
-q, --quiet quiet mode for background timer/stopwatch
-v, --version show program's version number and exit