Mercurial > hg > config
comparison python/epoch2date.py @ 666:fe6afbc1a38e
STUB: python/epoch2date.py
| author | Jeff Hammel <k0scist@gmail.com> |
|---|---|
| date | Thu, 17 Apr 2014 12:56:25 -0700 |
| parents | 93afa559ce77 |
| children | af95905ca177 |
comparison
equal
deleted
inserted
replaced
| 665:93afa559ce77 | 666:fe6afbc1a38e |
|---|---|
| 21 # produce a datetime | 21 # produce a datetime |
| 22 dt = datetime.datetime.fromtimestamp(options.seconds_since_epoch) | 22 dt = datetime.datetime.fromtimestamp(options.seconds_since_epoch) |
| 23 dt2 = datetime.datetime.utcfromtimestamp(options.seconds_since_epoch) | 23 dt2 = datetime.datetime.utcfromtimestamp(options.seconds_since_epoch) |
| 24 | 24 |
| 25 # output | 25 # output |
| 26 print (dt) | 26 print ("{} seconds since epoch".format(options.seconds_since_epoch)) |
| 27 print (dt2) | 27 print ("{} {}".format(dt, time.tzname[time.daylight])) |
| 28 print ("{} UTC".format(dt2)) | |
| 28 | 29 |
| 29 if __name__ == '__main__': | 30 if __name__ == '__main__': |
| 30 main() | 31 main() |
