w3resource

Python Arrow Module: Create a time object with the same hour, minute, second, microsecond and a timestamp representation of the Arrow object, in UTC time

Arrow Module: Exercise-22 with Solution

Write a Python program to create a time object with the same hour, minute, second, microsecond and a timestamp representation of the Arrow object, in UTC time.

Sample Solution:

Python Code:

import arrow
a = arrow.utcnow()
print("Current datetime:")
print(a)
print("\nTime object with the same hour, minute, second, microsecond:")
print(arrow.utcnow().time())
print("\nTimestamp representation of the Arrow object, in UTC time:")
print(arrow.utcnow().timestamp)

Sample Output:

Current datetime:
2019-06-04T06:17:46.489600+00:00

Time object with the same hour, minute, second, microsecond:
06:17:46.490600

Timestamp representation of the Arrow object, in UTC time:
1559629066

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 naïve (without time zone) datetime representation of the Arrow object.
Next: Write a Python program to parse a string representing a time according to a format.

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.



Become a Patron!

Follow us on Facebook and Twitter for latest update.

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://www.w3resource.com/python-exercises/arrow/python-arrow-exercise-22.php