DateTimeMate: A Golang lib and CLI for advanced date/time manipulation
DateTimeMate: A Golang lib and CLI for advanced date/time manipulation
DateTimeMate is a new open-source Golang package and CLI tool I've developed to tackle common date and time manipulation challenges. It's designed to provide a robust, flexible solution for developers working with temporal data in Go or directly from the command line. Key features: * Precise duration calculations between arbitrary dates/times * Date/time arithmetic with support for complex durations * Periodic calculations with customizable repetition * Flexible unit conversion for durations * Date/time reformatting ___ The CLI tool, dtmate, offers commands that mirror these core functionalities: diff: Calculate time differences dur: Perform date/time arithmetic conv: Convert between duration units fmt: Reformat date/time strings ___ What sets DateTimeMate apart: Intuitive syntax: The CLI accepts human-readable duration formats like "1 year 2 months 3 days 4 hours" as well as brief formats like "1Y2M3D4h". Relative date shortcuts: Supports keywords like "now", "today", "yesterday", "tomorrow" for quick calculations. Flexible unit handling: Converts between various time units, including sub-second precision (milliseconds, microseconds, nanoseconds). Consistent year definition: Uses 365.25 days per year for accurate long-term calculations. Dual-purpose design: Functions both as a standalone CLI tool and an importable Go package. ___ CLI Example: $ dtmate diff "2023-01-01 12:00:00" "2024-03-15 18:30:45" 1 year 2 months 14 days 6 hours 30 minutes 45 seconds $ dtmate dur today "1Y 2M 3W 4D 5h 6m 7s" -a 2025-10-19 17:06:07 $ dtmate conv 4321s123456789ns hms.msusns 1h12m1s123ms456us789ns ___ I built DateTimeMate to address the complexities often encountered in date/time manipulation, especially when dealing with mixed units or long-term calculations. It's particularly useful for tasks like: * Project timeline calculations * Age computations * Event scheduling and planning * Log analysis and time-based data processing ___ The project is open-source and available on GitHub: https://github.com/jftuga/DateTimeMate I'm keen to hear thoughts from the HN community. What other date/time challenges do you face in your projects? How could DateTimeMate be extended to better serve your needs?
Share cardActual performance
Launch Intel predictions
Analyze your own launch →Correct prediction on native model
Similar products
Arrow, better date & time manipulation for Python
The psychological war against AI manipulation
ColorKit – Advanced Color Manipulation for iOS
Array manipulation at compile time in C++11
The worst time/date selectors in the world
PyPIup – CLI that checks whether your PyPI requirements are up to date
Image Manipulation via Triangulation
Utdon – Are you up to date or not?
Real-time image manipulation with Voronoi/Delaunay
DOM registry for a better DOM Manipulation