Last active
January 15, 2016 15:18
-
-
Save GuiltyDolphin/7071d533175f17aae032 to your computer and use it in GitHub Desktop.
Quick script for parsing datestrings and returning the number of seconds since the Epoch they represent.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Parse a date string (using DateTime::Format::HTTP) and return the number of seconds since epoch it represents. | |
date-to-epoch-perl () { | |
perl -MDateTime::Format::HTTP -E "say DateTime::Format::HTTP::parse_datetime('$1')->strftime('%s');"; | |
} | |
# Better | |
date-to-epoch () { | |
date --date="$1" +%s; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment