8000 GitHub - miyaz/unix2date: convert unixtime included in STDIN to datetime and output.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

miyaz/unix2date

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

unix2date

convert unixtime included in STDIN to datetime and output.
"10 digit seconds” and “13 digits milliseconds” are subject to conversion.
By default, Convert all unixtime strings. You can filter within specified time period by using the filter options (-f/-t). Use -h option for other options description.

  1. install (homebrew)
brew install miyaz/tap/unix2date

if you can't use Homebrew, download the binary from Releases page.

or, build and use it as follows.

go build -o unix2date main.go
  1. execute
% cat << EOS | unix2date
1496405335 1496403935876
1718530010 1718530070235
EOS
2017-06-02T12:08:55Z 2017-06-02T11:45:35.876Z
2024-06-16T09:26:50Z 2024-06-16T09:27:50.235Z
  1. execute with the filter option
% cat << EOS | unix2date -f 2020-01-01T00:00:00Z
1496405335 1496403935876
1718530010 1718530070235
EOS
2024-06-16T09:26:50Z 2024-06-16T09:27:50.235Z
  1. show help
% unix2date -h
---
Usage:
  unix2date [-s]
  unix2date [-ni] [-f YYYY-mm-ddTHH:MM:SS(.NNN)Z] [-t YYYY-mm-ddTHH:MM:SS(.NNN)Z]
Options:
  -s (--summary)         Output only summary. (this option cannot be used with {-n,-i,-f,-t} options
  -n (--no-convert)      Output unixtime without converting
  -i (--invert-filter)   Invert and output filtered results
  -f (--filter-from) [filter start date (ex. 2024-07-01T00:30:00Z)]
  -t (--filter-to)   [filter end date   (ex. 2024-07-01T01:00:00Z)]
                         Output only lines containing unixtime within specified period
  -qt (--quotations) [characters for quotations (default: `"`)
  -sp (--separators) [characters for separators (default: ` ,\t`)
                         Set characters to detect unixtime

About

convert unixtime included in STDIN to datetime and output.

Resources

License

Stars

Watchers

Forks

Packages

No packages published
0