Created
December 4, 2011 04:43
-
-
Save seungjin/1429194 to your computer and use it in GitHub Desktop.
xdate; python extended date unix command
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 | |
# extended date command for *nix / writtern in python | |
# Copyright (c) 2011-2012, Seung-jin Kim, All right reserverd | |
# Twitter: @seungjin | |
import sys | |
import time | |
from time import gmtime, strftime | |
# *nix extended date command | |
# copyright (c) Seung-jin Kim | |
# Based on ISO 8601 | |
# Reference: http://en.wikipedia.org/wiki/ISO_8601 | |
def print_copyright(): | |
print "extended date commnad for *nix / writtern in python" | |
print "Copyright (c) 2011 - 2012, Seung-jin Kim, All right reserved" | |
print "Twitter: @seungjin" | |
def print_help(): | |
pass | |
def print_current_time(): | |
#print "Current timezone is %s , %s" % (time.tzname[0], time.tzname[1]) | |
print "Local time is %s" % time.strftime('%X %x %Z') | |
print "Local unix timestamp is " | |
print "UTC time is %s" % strftime('%X %x UTC', gmtime()) | |
print "UTC unix timestamp is " | |
def main(): | |
#print sys.argv | |
print_copyright() | |
print_current_time() | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment