Skip to content

Instantly share code, notes, and snippets.

@yowcow
Created February 22, 2018 01:34
Show Gist options
  • Save yowcow/a564b8ad2d6632d9133b60dfcbe6eb42 to your computer and use it in GitHub Desktop.
Save yowcow/a564b8ad2d6632d9133b60dfcbe6eb42 to your computer and use it in GitHub Desktop.
Converting epoch second to date time, and vice versa
EPOCH = 0
DATE = 1970-01-01 00:00:00 JST
all:
now:
date
date +%s
date:
date -d @$(EPOCH)
epoch:
date -d"$(DATE)"
date -d"$(DATE)" +%s
.PHONY: all now date epoch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment