Python Arrow Module: Create a time object with the same hour, minute, second, microsecond and timezone info
Arrow Module: Exercise-24 with Solution
Write a Python program to create a time object with the same hour, minute, second, microsecond and timezone info.
Sample Solution:
Python Code:
import arrow
a = arrow.utcnow()
print("Current datetime:")
print(a)
print("\nTime object with the same hour, minute, second, microsecond and timezone info.:")
print(arrow.utcnow().timetz())
Sample Output:
Current datetime: 2019-06-04T06:14:37.163600+00:00 Time object with the same hour, minute, second, microsecond and timezone info.: 06:14:37.166600+00:00
Python Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: Write a Python program to parse a string representing a time according to a format.
Next: Write a Python program to get the proleptic Gregorian ordinal of a given date.
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-24.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics