Giter VIP home page Giter VIP logo

gots's Introduction

gots

gots is a crude UNIX timestamp manipulation CLI utility.

In addition to converting between human readable time/date format and UNIX timestamps, it also allows you to increment and decrement time by seconds, minutes, hours, days, months and years. Supports unix nanos.

Usage

❯ gots
RFC3339: 2023-01-18T21:36:37-08:00
Unix: 1674106597
UnixNano: 1674106597905104000
---------------------
RFC3339 (UTC): 2023-01-19T05:36:37Z
Unix (UTC): 1674106597
UnixNano (UTC): 1674106597905104000

❯ gots 1674106597
RFC3339: 2023-01-18T21:36:37-08:00
Unix: 1674106597
UnixNano: 1674106597000000000
---------------------
RFC3339 (UTC): 2023-01-19T05:36:37Z
Unix (UTC): 1674106597
UnixNano (UTC): 1674106597000000000

❯ gots 1674106597905104000 +1y
handling time shift
RFC3339: 2024-01-18T21:36:37-08:00
Unix: 1705642597
UnixNano: 1705642597905104000
---------------------
RFC3339 (UTC): 2024-01-19T05:36:37Z
Unix (UTC): 1705642597
UnixNano (UTC): 1705642597905104000

Note that in order to convert dates from "string" format (ie. "01/02/2014 01:02:03"), the provided time format must match it exactly.

Accuracy

The generated timestamps can be a bit inaccurate - namely because I decided to not meddle with timezones, DST or any other time-related pains. This works for me, but may be a problem for you.

NOTE: I wrote this in 2015 when I just picked up Go :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.