How to get date and time from another timezone in Python?

How to get the date and time from another timezone in Python?

You may use the pytz library. Example usage as follows.

$ python3
Python 3.8.2 (default, Jul 16 2020, 14:00:26) 

>>> from datetime import datetime
>>> import pytz
>>> 
>>> print(datetime.now(pytz.timezone('Europe/Amsterdam')).strftime('%Y-%m-%d %H:%M:%S %Z%z'))
2020-08-09 15:50:00 CEST+0200
>>> 

Similar Posts

  • How to edit eps file?

    I have made some eps figures for my paper but now I wanna modify them. How to edit them now? You may try inkscape on Linux: https://inkscape.org/en/ It can edit eps files. Read more: How to make eps files using gnuplot How to Convert JPG Images to EPS An Online JPG to EPS Converter How…

  • |

    How to compare date in SQL?

    How to compare date in SQL? For example, the ‘users’ table has a column ‘loggin’ which is the date and time. How to find out the ‘users’ whose ‘loggin’ date is later than Jan 10, 2017? In SQL, dates can be compared using ‘’, ‘=‘. For the example described, the SQL statement could be: SELECT…

  • Free server images – SysTutorials QA

    Any free server images? 24 Free Data Center Photos from fatcow.com 24 Free Data Center Photos: http://www.fatcow.com/data-center-photos From Wikimedia commons: Multiple servers: http://commons.wikimedia.org/wiki/File:Server-multiple.svg Server: http://commons.wikimedia.org/wiki/File:Server.svg Yellow server: http://commons.wikimedia.org/wiki/File:Server-yellow.svg Green server: http://commons.wikimedia.org/wiki/File:Server-green.svg More from clker.com: Web Virtualization Server clip art: http://www.clker.com/clipart-1826.html Small Case Web Mail Server clip art: http://www.clker.com/clipart-1902.html Inside our data centers from Google —…

  • What are popular / good NoSQL databases?

    What are the popular / good NoSQL databases nowadays? MongoDB, CouchDB Find more at https://en.wikipedia.org/wiki/NoSQL and http://nosql-database.org/ Answered by omshivaprakash. Read more: SQL layers on NoSQL databases Consistency models for distributed systems Adding Custom Buttons to the WordPress HTML Editor Force Linux to reboot What’s wrong with the messages like “UnrecovData 10B8B BadCRC” and “failed…

  • How to quite VirtualBox scale mode?

    How to quite VirtualBox scale mode? Use this hot key shortcut to quit VirtualBox scale mode Right_Ctrl + c Read more: How to change the mode for simplified Chinese or Traditional Chinese mode in ibus-libpinyin? Large-scale Data Storage and Processing System in Datacenters Software Engineering Advice from Building Large-Scale Distributed Systems by Jeff Dean VirtualBox…