Python Arrow Module: Create a datetime object, converted to the specified timezone using arrow module
Arrow Module: Exercise-12 with Solution
Write a Python program to create a datetime object, converted to the specified timezone using arrow module.
Sample Solution:
Python Code:
import arrow
utc = arrow.utcnow()
pacific=arrow.now('US/Pacific')
nyc=arrow.now('America/Chicago').tzinfo
print(pacific.astimezone(nyc))
Sample Output:
2019-06-01 06:04:28.600000-05:00
Python Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: Write a Python program to create a new Arrow object, cloned from the current one.
Next: Write a Python program to create a new Arrow object, representing the "ceiling" of the timespan of the Arrow object in a given timeframe using arrow module. The timeframe can be any datetime property like day, hour, minute.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://198.211.115.131/python-exercises/arrow/python-arrow-exercise-12.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics