Of all the console utilities that I have written to support my systems automation endeavors, my first, favorite, and most extensively used utility is: DATEINFO.EXE.
Over the years (decades), I have developed many Windows Shell scripts which needed to be able track time backwards and forwards. Natively, that was cumbersome. Thankfully, I ran into a utility DOFF.EXE which proved to be very valuable, and I made extensive use of it for a number of years.
DOFF had a few limitations of its own, such as only calculating offsets as +/- days, not weeks, months, or years. (Yes, years is easy, but the others aren’t.) After searching around for some time for a better utility, I made the determination that it would be easier to just write my own. So that I did.
As you can see if you look at the ChangeLog, DATEINFO started out with just a couple of basic features that I needed at that time, and it stayed that way for about a year and a half. Soon enough, however, I found reasons to add more functionality, including the ability to calculate the difference between any two days. After some more time passed, I added the ability to perform time calculations, and enabled more flexible display options, and suddenly this utility became far more prominent in many more scripts.
The most popular routine entails tracking how long each script takes to execute, which really comes in handy for noticing discrepancies in operation. At present, the list of features is pretty extensive, and the utility comes in both 64-bit and 32-bit flavors. There are still things that I find faster to accomplish in the Windows Shell than other scripting languages, although PowerShell is clearly more powerful and robust, and this utility helps make me more productive.
I have definitely gotten a lot of life from DATEINFO, and it has allowed me to replace virtually every other date/time utility I previously used (except those that can change file timestamps).
Since it is a console utility, you can use it with any scripting language on Windows…