Have you ever needed the exact date a certain number of days in the future? The Command-Line Fu site shows how to use the date command to calculate future (and past) dates.
Using the date command is simple—just open a terminal window on your Mac, Linux, or Windows with Cygwin desktop, use the date command with the -d parameter, and pass in a number of date increments in the future in days, minutes, years, months, or even weeks. For instance, to find the date 3 weeks in the future, use the following command from the shell prompt:
date -d “3 weeks”
To find the date from a period of time in the past, you would add “ago” to the end of the command:
date -d “3 weeks ago”
You can even combine the arguments together—so if you wanted to find the exact date for 3 weeks and 2 days in the future, you would use:
date -d “3 weeks 2 days”
It’s a very simple tip, but for those of us that have a terminal window open at all times, it can really come in handy. For more geeky terminal tips, check out how to display a list of just the subdirectories, turn any Linux directory into an ISO file, or take a look through our top 10 command-line tools.
Date shows dates at other times/dates [Command-Line Fu]