All Projects → jarun → Pdd

jarun / Pdd

Licence: gpl-3.0
📅 Tiny date, time diff calculator with piggybacked timers

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Pdd

Bcal
🔢 Storage and general-purpose calculator
Stars: ✭ 329 (+50.92%)
Mutual labels:  terminal, command-line, console, calculator
Wonders
🌈 Declarative JavaScript framework to build command-line applications.
Stars: ✭ 34 (-84.4%)
Mutual labels:  terminal, command-line, console
Cointop
A fast and lightweight interactive terminal based UI application for tracking cryptocurrencies 🚀
Stars: ✭ 2,912 (+1235.78%)
Mutual labels:  terminal, command-line, console
Mandown
man-page inspired Markdown viewer
Stars: ✭ 173 (-20.64%)
Mutual labels:  terminal, command-line, console
Suplemon
🍋 Console (CLI) text editor with multi cursor support. Suplemon replicates Sublime Text like functionality in the terminal. Try it out, give feedback, fork it!
Stars: ✭ 734 (+236.7%)
Mutual labels:  terminal, command-line, console
Imgp
📸 High-performance cli batch image resizer and rotator
Stars: ✭ 744 (+241.28%)
Mutual labels:  terminal, command-line, console
Rang
A Minimal, Header only Modern c++ library for terminal goodies 💄✨
Stars: ✭ 1,080 (+395.41%)
Mutual labels:  terminal, command-line, console
Terminal
The new Windows Terminal and the original Windows console host, all in the same place!
Stars: ✭ 79,371 (+36308.72%)
Mutual labels:  terminal, command-line, console
Tooling
Advancing Node.js as a framework for writing great tools
Stars: ✭ 98 (-55.05%)
Mutual labels:  terminal, command-line, console
Word Wrap
Wrap words to a specified length.
Stars: ✭ 107 (-50.92%)
Mutual labels:  terminal, command-line, console
Nnn
n³ The unorthodox terminal file manager
Stars: ✭ 13,138 (+5926.61%)
Mutual labels:  terminal, command-line, console
Googler
🔍 Google from the terminal
Stars: ✭ 5,594 (+2466.06%)
Mutual labels:  terminal, command-line, console
Buku
🔖 Personal mini-web in text
Stars: ✭ 4,825 (+2113.3%)
Mutual labels:  terminal, command-line, console
Tldr
📚 Collaborative cheatsheets for console commands
Stars: ✭ 36,408 (+16600.92%)
Mutual labels:  terminal, command-line, console
Ddgr
🦆 DuckDuckGo from the terminal
Stars: ✭ 2,243 (+928.9%)
Mutual labels:  terminal, command-line, console
Crossline
A small, self-contained, zero-config, MIT licensed, cross-platform, readline and libedit replacement.
Stars: ✭ 53 (-75.69%)
Mutual labels:  terminal, command-line, console
Mitype
Typing speed test in terminal
Stars: ✭ 241 (+10.55%)
Mutual labels:  terminal, command-line, console
Laravel Zero
A PHP framework for console artisans
Stars: ✭ 2,821 (+1194.04%)
Mutual labels:  terminal, command-line, console
Window Size
Reliable way to to get the height and width of the terminal/console in a node.js environment.
Stars: ✭ 79 (-63.76%)
Mutual labels:  terminal, command-line, console
Smenu
smenu started as a lightweight and flexible terminal menu generator, but quickly evolved into a powerful and versatile CLI selection tool for interactive or scripting use.
Stars: ✭ 1,906 (+774.31%)
Mutual labels:  terminal, command-line, console

pdd

Latest release Availability PyPI Build Status License

Asciicast

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.

Love smart and efficient utilities? Explore my repositories. Buy me a cup of coffee if they help you.

Donate via PayPal!

Table of Contents

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.6 (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.

Packaging status (expand)


Packaging status

Unlisted packagers:


PyPI (pip3 install pdd)
● Termux (pip3 install pdd)

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Ⓜ️s]] [--add] [--sub]
           [--day yyyy mmm dd] [-c hh:mm:ss] [-r command] [-s [resolution]]
           [-q]
           [keywords [keywords ...]]

Tiny date, time difference calculator with timers.

positional arguments:
  keywords              diff/add/subtract from today or now

optional arguments:
  -h, --help            show this help message and exit
  -d yyyy mmm dd [yyyy mmm dd | y m d]
                        calculate date difference
  -t hh:mm:ss [hh:mm:ss | hⓂ️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           start a countdown timer
  -r command            run command when countdown timer reaches 0
  -s [resolution]       start a stopwatch [default resolution: 3 (ms)]
  -q                    quiet mode for background timer/stopwatch

Operational notes

  • ISO 8601 format. Month can be specified as month number (e.g. Jan - 1, Dec - 12).
  • Time is in 24-hr format.
  • The absolute difference is shown. Argument order is ignored.
  • The end date is excluded in date difference calculations.
  • Hour, minute or second can be omitted. Partial inputs are recognized as mm:ss or ss.
  • The keybind to stop timers is Ctrl-C.

Examples

  1. Calculate diff from today:

    $ pdd 2014 Jan 15
    5y 2m 21d
    1906d
    
  2. Calculate diff from now:

    $ pdd 24:00:00
    15:24:03
    55443s
    
    $ pdd 0
    08:36:22
    30982s
    
  3. Calculate date diff:

    $ pdd -d 1983 jul 3 2014 1 15
    30y 6m 12d
    11154d
    
  4. Calculate time diff:

    $ pdd -t 45:50 6:17:33
    05:31:43
    19903s
    
  5. Show current date, time and timezone:

    $ pdd
    Fri 2019 Apr 5 08:37:25 IST
    
  6. Specify time with roll-over:

    $ pdd -t 5:80:75 6:17:33
    00:03:42
    222s
    
  7. Add a duration (3 years, 2 months, 1 day) to 28 Feb, 2000:

    $ pdd -d 2000 FEB 28 3 2 1 --add
    Tue 2003 Apr 29
    
  8. Add a timeslice (1 hour 2 mins 3 secs) to 23:45:37:

    $ pdd -t 23:45:37 1:2:3 --add
    1 day(s) later, 00:47:40
    89260s
    
  9. Add a duration (3 years, 2 months, 1 day) to today:

    $ pdd 3 2 1 --add
    Mon 2022 Jun 06
    
  10. Add a timeslice (1 hour 2 minutes 3 seconds) to now:

    $ pdd 1:2:3 --add
    09:41:26
    34886s
    
  11. Subtract a duration (1 day) from 1 Mar, 2000:

    $ pdd -d 2000 Mar 01 0 0 1 --sub
    Tue 2000 Feb 29
    
  12. Subtract a timeslice (1 sec) from midnight:

    $ pdd -t 00:00:00 0:0:1 --sub
    1 day(s) earlier, 23:59:59
    -1s
    
  13. Subtract a duration (3 years, 2 months, 1 day) from today:

    $ pdd 3 2 1 --sub
    Thu 2016 Feb 04
    
  14. Subtract a timeslice (1 hour 2 minutes 3 seconds) from now:

    $ pdd 1:2:3 --sub
    07:40:02
    27602s
    
  15. Show the day of the week on 15 Jan 2014:

    $ pdd --day 2014 Jan 15
    Wed
    
  16. Start a countdown timer or stopwatch in quiet mode in the background:

    $ pdd -qs &
    $ pdd -qc 3:0:0 &
    

    To see the final counter run fg and press Ctrl-C.

  17. Run a command when countdown timer reaches 0

    $ pdd -c 00:00:5 -r 'ps -aux'
    $ pdd -c 00:00:5 -r 'notify-send pdd "timer expired"'
    

Copyright

Copyright © 2017 Arun Prakash Jana

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].