diff options
author | pux <pux@raumdock.pux.dom> | 2023-01-07 14:17:56 +0100 |
---|---|---|
committer | pux <pux@raumdock.pux.dom> | 2023-01-07 14:17:56 +0100 |
commit | 6a0dd29d364844b24f1b6dc4beb2e20b5a634ac2 (patch) | |
tree | d84e36efce0fa74989c4b31978069dc8f81fcc54 /data/rfc822date.py | |
parent | 407572b5f49d89baad3dd0ef3d50b89a3b1ae451 (diff) | |
download | muckedout-6a0dd29d364844b24f1b6dc4beb2e20b5a634ac2.tar.gz muckedout-6a0dd29d364844b24f1b6dc4beb2e20b5a634ac2.tar.bz2 muckedout-6a0dd29d364844b24f1b6dc4beb2e20b5a634ac2.zip |
update from pub-docs
Diffstat (limited to 'data/rfc822date.py')
-rwxr-xr-x | data/rfc822date.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/data/rfc822date.py b/data/rfc822date.py new file mode 100755 index 0000000..8ea9446 --- /dev/null +++ b/data/rfc822date.py @@ -0,0 +1,27 @@ +#!/bin/env python3 + +from datetime import datetime +import sys + +def help(): + print(sys.argv[0] + " YYYY-MM-DD-HHMMSS [+XXXX]") + +# test +#indate = "2022-12-22-182343" + +timezone = "+0000" + +if len(sys.argv) <= 1: + print("error no arg") + help() + sys.exit() +if len(sys.argv) == 3: + timezone = sys.argv[2] +if len(sys.argv) > 3: + print("error > 2 args") + help() + sys.exit() + +indate = sys.argv[1] +d = datetime.strptime(indate, "%Y-%m-%d-%H%M%S") +print(d.strftime("%a, %d %b %Y %H:%M:%S") + " " + timezone) |