TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: DateTimeMate: A Golang lib and CLI for advanced date/time manipulation

1 pointsby jftuga10 months ago
DateTimeMate is a new open-source Golang package and CLI tool I&#x27;ve developed to tackle common date and time manipulation challenges. It&#x27;s designed to provide a robust, flexible solution for developers working with temporal data in Go or directly from the command line.<p>Key features:<p>* Precise duration calculations between arbitrary dates&#x2F;times<p>* Date&#x2F;time arithmetic with support for complex durations<p>* Periodic calculations with customizable repetition<p>* Flexible unit conversion for durations<p>* Date&#x2F;time reformatting<p>___<p>The CLI tool, dtmate, offers commands that mirror these core functionalities:<p>diff: Calculate time differences<p>dur: Perform date&#x2F;time arithmetic<p>conv: Convert between duration units<p>fmt: Reformat date&#x2F;time strings<p>___<p>What sets DateTimeMate apart:<p>Intuitive syntax: The CLI accepts human-readable duration formats like &quot;1 year 2 months 3 days 4 hours&quot; as well as brief formats like &quot;1Y2M3D4h&quot;.<p>Relative date shortcuts: Supports keywords like &quot;now&quot;, &quot;today&quot;, &quot;yesterday&quot;, &quot;tomorrow&quot; for quick calculations.<p>Flexible unit handling: Converts between various time units, including sub-second precision (milliseconds, microseconds, nanoseconds).<p>Consistent year definition: Uses 365.25 days per year for accurate long-term calculations.<p>Dual-purpose design: Functions both as a standalone CLI tool and an importable Go package.<p>___<p>CLI Example:<p>$ dtmate diff &quot;2023-01-01 12:00:00&quot; &quot;2024-03-15 18:30:45&quot;<p>1 year 2 months 14 days 6 hours 30 minutes 45 seconds<p>$ dtmate dur today &quot;1Y 2M 3W 4D 5h 6m 7s&quot; -a<p>2025-10-19 17:06:07<p>$ dtmate conv 4321s123456789ns hms.msusns<p>1h12m1s123ms456us789ns<p>___<p>I built DateTimeMate to address the complexities often encountered in date&#x2F;time manipulation, especially when dealing with mixed units or long-term calculations. It&#x27;s particularly useful for tasks like:<p>* Project timeline calculations<p>* Age computations<p>* Event scheduling and planning<p>* Log analysis and time-based data processing<p>___<p>The project is open-source and available on GitHub: <a href="https:&#x2F;&#x2F;github.com&#x2F;jftuga&#x2F;DateTimeMate">https:&#x2F;&#x2F;github.com&#x2F;jftuga&#x2F;DateTimeMate</a><p>I&#x27;m keen to hear thoughts from the HN community. What other date&#x2F;time challenges do you face in your projects? How could DateTimeMate be extended to better serve your needs?

no comments

no comments