A command line tool that converts between time and timestamp.
Installation
Make sure your Go Version is greater than 1.13. And simply run:
$ GO111MODULE=on go get github.com/gg-tools/timestamp
Make sure your PATH
includes the $GOPATH/bin
directory so commands can be easily used:
export PATH=$PATH:$GOPATH/bin
Usage
Get timestamp of a specific time:
$ timestamp
1596355497 (2020-08-02 16:04:57)
$ timestamp 1988-08-13
1596326400 (2020-08-02 00:00:00)
$ timestamp "1988-08-13 18:06:06"
1596391566 (2020-08-02 18:06:06)
Get timestamp of now plus 1 year 3 days 4 hours 5 minutes 6 seconds and minus 2 months:
$ timestamp +1y -2m 3d 4h 5i 6s
1622895151 (2021-06-05 20:12:31)
Time
Get current time:
$ timestamp time
Get time from timestamps:
$ timestamp time 587433600
1988-08-13 09:00:00 (587433600)
$ timestamp t 587433600 1597276800
1988-08-13 09:00:00 (587433600)
2020-08-13 08:00:00 (1597276800)