Created
July 31, 2012 21:48
-
-
Save acarrillo/3220925 to your computer and use it in GitHub Desktop.
A simple filter for converting UNIX epoch timestamps to a more readable format -- works great with Vim!
This file contains hidden or 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
#!/usr/bin/env python | |
'''A filter that takes a UNIX epoch timestamp as input, and outputs the date in a more human-friendly format | |
Put this file somewhere in your PATH and 'chmod +x' it. | |
In your ~/.vimrc: | |
vnoremap <silent> <F6> :!datefiltr.py<CR> | |
''' | |
import fileinput | |
from time import strftime, gmtime | |
__author__ = 'Kevin Wang and Alex Carrillo' | |
output = '' | |
for line in fileinput.input(): | |
output += strftime("%c",gmtime(int(line))) + ('\n' if line[-1] == '\n' else '') | |
print output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@kevinwang -- woo!