Python Arrow Module: Create a time object with the same hour, minute, second, microsecond and timezone info
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.
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics