zoukankan      html  css  js  c++  java
  • London2012同步时间新语

    #!/usr/bin/env python
    #encoding="utf-8"
    """
    free use navicat & sqlyog
    """
    import datetime
    from dateutil import parser
    if __name__=="__main__":
        import sys,os
        if len(sys.argv)>1:
            import urllib2
            r=urllib2.urlopen("http://www.london2012.com/")
            t=r.headers.dict["date"]
            print t
            dt=parser.parse(t)
            dt=dt+datetime.timedelta(hours=8)//chage gmt datetime to gmt+8 area time
            print "%s-%s-%s %s:%s:%s"%(dt.year,dt.month,dt.day,dt.hour,dt.minute,dt.second)
            os.system("date %s-%s-%s"%(dt.year,dt.month,dt.day))
            os.system("time %s:%s:%s"%(dt.hour,dt.minute,dt.second))
            print "datetime back to normal %s"%datetime.datetime.now()
        else:
            os.system("date 2012-03-20")
            print "this is only for software expired used"
            print "datetime change to %s"%datetime.datetime.now()

  • 相关阅读:
    Comparable VS Comparator
    Javascript中this关键字详解
    Runtime、System、Object
    JS IDE
    异常处理
    Throwable vs Exception
    8.4 Java 命名规范
    关键字、标识符、注释、变量
    Docker —— 从入门到实践
    RTC教程
  • 原文地址:https://www.cnblogs.com/lexus/p/2620722.html
Copyright © 2011-2022 走看看