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
#!/bin/sh | |
date | |
# outputs Fri Jan 25 12:10:33 CST 2019 | |
# alternative: add to bash_profile | |
timestamp() { | |
date +"%T" | |
} |
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
import time | |
import datetime | |
# credit: squiguy https://stackoverflow.com/a/13891070 | |
t_stamp = time.time() | |
t_stamp_string = datetime.datetime.fromtimestamp(t_stamp).strftime('%Y-%m-%d %H:%M:%S') | |
# output: 2019-01-25 12:06:02 | |
t_stamp_string = datetime.datetime.fromtimestamp(t_stamp).strftime('%Y.%m.%d.%H.%M.%S') | |
# output: 2019.01.25.12.07.16 |