compute/data-munging.md
... ...
@@ -25,3 +25,13 @@ BEGIN {
25 25
26 26
### Paginated REST results
27 27
Paginated json coming back from a rest api? Use a python generator to return it.
28
+
29
+### Convert Unix time to a different TZ in python
30
+```
31
+import time
32
+from datetime import datetime
33
+from pytz import timezone, utc
34
+now = time.time()
35
+t = datetime.utcfromtimestamp(now)
36
+lt = utc.localize(t).astimezone(london)
37
+print(lt.strftime('%Y-%m-%d %H:%M:%S %Z'))