Menu

Tree [71b258] master /
 History

HTTPS access


File Date Author Commit
 CHANGELOG 2017-07-19 Arun Prakash Jana Arun Prakash Jana [d9c282] Release v1.0
 LICENSE 2017-07-15 Arun Prakash Jana Arun Prakash Jana [67c7c0] Initial commit
 Makefile 2017-07-16 Arun Prakash Jana Arun Prakash Jana [ff0cb5] Add Makefile
 README.md 2017-08-01 Arun Prakash Jana Arun Prakash Jana [71b258] Show day of the week on a date
 pdd 2017-08-01 Arun Prakash Jana Arun Prakash Jana [71b258] Show day of the week on a date
 pdd.1 2017-08-01 Arun Prakash Jana Arun Prakash Jana [71b258] Show day of the week on a date

Read Me

pdd

Latest release AUR License

There are times you want to check how old you are (in years, months, days) or how long you need to wait for the next flash sale... pdd (python3 date diff) is a small cmdline utility to calculate date and time difference. If no program arguments are specified it shows the current date, time and timezone.

Donate via PayPal!

Table of Contents

Features

  • calculate date difference
  • calculate time difference
  • calculate diff from today and now
  • add, subtract duration (timeslice) to/from date (time)
  • show current date, time and timezone
  • minimal dependencies

Installation

Dependencies

pdd requires Python 3.5 (or later) and the dateutil module.

To install dateutil on Ubuntu, run:

$ sudo apt-get install python3-dateutil

or, using pip3:

$ sudo pip3 install dateutil

Installing from this repository

If you have git installed, clone this repository. Otherwise download the 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. You may need to use sudo with PREFIX depending on your permissions on destination directory.

Running as a standalone utility

pdd is a standalone utility. From the containing directory, run:

$ ./pdd

Usage

cmdline options

usage: pdd [-h] [-d dd mmm yyyy [dd mmm yyyy | d m y]]
           [-t hh:mm:ss [hh:mm:ss | h:m:s]] [--add] [--sub]
           [keywords [keywords ...]]

Date, time difference calculator.

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

optional arguments:
  -h, --help            show this help message and exit
  -d dd mmm yyyy [dd mmm yyyy | d m y]
                        calculate date difference
  -t 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 dd mmm yyyy     show day of the week on a date

Operational notes

  • Time is in 24-hr format.
  • Month can be specified as month number (e.g. Jan - 1, Dec - 12).
  • 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.

Examples

  1. Calculate date diff:

    $ pdd -d 3 jul 1983 15 1 2014
    
  2. Calculate time diff:

    $ pdd -t 45:50 6:17:33
    
  3. Show current date, time and timezone:

    $ pdd
    
  4. Specify time with roll-over:

    $ pdd -t 5:80:75 6:17:33
    
  5. Calculate diff from today:

    $ pdd 15 Jan 2015
    
  6. Calculate diff from now:

    $ pdd 24:00:00
    $ pdd 0
    
  7. Add a duration (1 day, 2 months, 3 years) to 28 Feb, 2000:

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

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

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

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

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

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

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

    $ pdd 1:2:3 --sub
    
  15. Show the day of the week on 15 Jan 2014:

    $ pdd --day 15 Jan 2014
    

Copyright © 2017 Arun Prakash Jana

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.