is_epoch - Guess if the given string could be an epoch time.
is_epoch - guess if the given number is an epoch
is_epoch [OPTIONS] number [number ...]
Default is year 0001 to 9999, which is probably too much output. To get less, change the min and max values:
$ is_epoch 1234567890 --min 2007 --max 2017 2016-12-22T00:22:36Z (1234567890, decimal, dos) 2009-02-13T23:31:30Z (1234567890, decimal, unix) 2007-03-16T23:31:30Z (1234567890, decimal, google_calendar)
You can also ask for JSON output instead.
$ is_epoch 1234567890 --min 2007 --max 2017 --output=as_json {"1234567890":{"decimal":{"dos":"2016-12-22T00:22:36Z","unix":"2009-02-13T23:31:30Z","google_calendar":"2007-03-16T23:31:30Z"}}}
To make it more readable, just pipe it json_xs or or jq whatever your favorite JSON prettifier is.
$ is_epoch 1234567890 --min 2007 --max 2017 --output=as_json | json_xs { "1234567890" : { "decimal" : { "unix" : "2009-02-13T23:31:30Z", "dos" : "2016-12-22T00:22:36Z", "google_calendar" : "2007-03-16T23:31:30Z" } } }
Most things are looking for a decimal or hexadecimal string, but you can also put a whole UUID in and it will grab the parts that make the date-time.
$ is_epoch 33c41a44-6cea-11e7-907b-a6006ad3dba0 2017-07-20T01:24:40.472634Z (33c41a44-6cea-11e7-907b-a6006ad3dba0, uuid_v1, uuid_v1)
That's a version 1 UUID. Now there are more UUIDs with timestamps in them (https://uuid6.github.io/uuid6-ietf-draft/).
Version 6 UUIDs also contain a uuid_v1 timestamp, but the bits are in a different order
$ is_epoch 1e76cea3-3c41-6a44-907b-a6006ad3dba0 2017-07-20T01:24:40.472634Z (1e76cea3-3c41-6a44-907b-a6006ad3dba0, uuid_v6, uuid_v1)
Version 7 UUIDs contain a java timestamp (Unix time in milliseconds)
$ is_epoch 017F22E2-79B0-7CC3-98C4-DC0C0C07398F 2022-02-22T19:22:22Z (017F22E2-79B0-7CC3-98C4-DC0C0C07398F, uuid_v7, java)
ULIDs (https://github.com/ulid/spec) also have java timestamps in them
$ is_epoch 01FWHE4YDGFK1SHH6W1G60EECF 2022-02-22T19:22:22Z (01FWHE4YDGFK1SHH6W1G60EECF, ulid, java)
Prints extra messages.
Prints a brief help message and exits.
Prints the manual page and exits.
Maximum date to print out. Default is 9999-12-31T23:59:59Z. It's just a string compare, so you can include as little or as much of an ISO-8601 date as you want (e.g., --max_date=2017).
Minimum date to print out. Default is 0001-01-01T00:00:00Z. It's just a string compare, so you can include as little or as much of an ISO-8601 date as you want (e.g., --min_date=2017).
Output format (as_string or as_json). Default as_string.
Prints results in more detail.
is_epoch will guess if any of the conversions from Time::Moment::Epoch gives a reasonable date for the given numbers.
version 1.004001
Tim Heaney <heaney@cpan.org>
This software is copyright (c) 2017 by Tim Heaney.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Time::Moment::Epoch, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Time::Moment::Epoch
CPAN shell
perl -MCPAN -e shell install Time::Moment::Epoch
For more information on module installation, please visit the detailed CPAN module installation guide.