Browse Source

* multi clock utility in different timezones /A

Anton 8 months ago
parent
commit
8396ea59d5
1 changed files with 30 additions and 0 deletions
  1. 30 0
      console-terminal/multiclock.py

+ 30 - 0
console-terminal/multiclock.py

@@ -0,0 +1,30 @@
+#!/usr/local/bin/python3
+
+#
+# this script will show time and date in different locations
+# Author: Anton TETERIN
+# web:    https://2dz.fi
+#
+
+# 2024-04-28  * init /A
+
+from datetime import datetime
+import pytz
+
+ts_utc = pytz.utc
+
+zones = [
+    "UTC",
+    "Europe/Dublin",
+    "Europe/Madrid",
+    "Europe/Paris",
+    "Europe/Helsinki",
+    "Europe/Moscow",
+    "Asia/Riyadh",
+    "Asia/Dubai",
+    "Asia/Sakhalin"
+]
+
+for zone in zones:
+  ts = pytz.timezone(zone)
+  print ( "  ", datetime.now(ts).strftime("%Y-%m-%d %H:%M:%S"), " in ", ts )