w3resource

Python Arrow Module: Create datetime from integers, floats and strings timestamps using arrow module

Arrow Module: Exercise-2 with Solution

Write a Python program to create datetime from integers, floats and strings timestamps using arrow module.

Sample Solution:

Python Code:

import arrow
i = arrow.get(1857900545)
print("Date from integers: ")
print(i)
f = arrow.get(1857900545.234323)
print("\nDate from floats: ")
print(f)
s = arrow.get('1857900545')
print("\nDate from Strings: ")
print(s)

Sample Output:

Date from integers: 
2028-11-15T11:29:05+00:00

Date from floats: 
2028-11-15T11:29:05.234323+00:00

Date from Strings: 
2028-11-15T11:29:05+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 get the current UTC datetime, local datetime and datetime of a given location using arrow module.
Next: Write a Python program to create a datetime from a given timezone-aware datetime using arrow module.

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