Skip to content

Instantly share code, notes, and snippets.

@hiulit
Created February 28, 2018 11:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hiulit/89bbff523dbaa286c09923eda17c2e31 to your computer and use it in GitHub Desktop.
Save hiulit/89bbff523dbaa286c09923eda17c2e31 to your computer and use it in GitHub Desktop.
Convert unhyphenated datetime (20180228T125033) into 2018-02-28T12:50:33
date="$(echo "20180228T125033" | cut --output-delimiter=$'-' -c1-4,5-6,7-8)"
time="$(echo "20180228T125033" | cut --output-delimiter=$'-' -c10-11,12-13,14-15)"
date --utc --date "$date $time" +%s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment