Simple application for generating RFC3339 timestamps, written in Go.
Install the program like this:
go install github.com/mojotx/date-manipulator@latest
To get the current UTC timestamp in RFC3339 format, just run the binary:
$ date-manipulator
2021-06-02T20:56:32Z
To get the UTC timestamp of 15 minutes ago, specify a valid Go time.Duration string, like this:
$ date-manipulator -15m
2021-06-02T20:43:38Z
To see 15 minutes ago, as well as current time, assuming Bash as your shell:
printf "Past %22s\n Now %22s\n" $(date-manipulator -15m) $(date-manipulator)
Past 2021-06-02T20:47:19Z
Now 2021-06-02T21:02:19Z
Note that there are multiple time.Duration units suffixes, including "ns", "us" (or "µs"), "ms", "s", "m", and "h".
$ date-manipulator ; date-manipulator 12h
2021-06-02T21:05:45Z
2021-06-03T09:05:45Z
I wrote this for scripting cloud things, such as AWS CLI commands. For instance, to see CPU utilization for the past 12 hours in JSON format:
$ aws cloudwatch get-metric-statistics \
--namespace AWS/RDS \
--metric-name CPUUtilization \
--period 60 \
--statistics Maximum \
--dimensions Name=DBInstanceIdentifier,Value=some-database-cluster \
--start-time $( date-manipulator -12h ) \
--end-time $( date-manipulator )
This is licensed under the MIT license. If you find it useful, great!