w3resource

Python Arrow Module: Get a datetime or timestamp representation from current datetime

Arrow Module: Exercise-5 with Solution

Write a Python program to get a datetime or timestamp representation from current datetime.

Sample Solution:

Python Code:

import arrow
a = arrow.utcnow()
print("Datetime representation:")
print(a.datetime)
b = a.timestamp
print("\nTimestamp representation:")
print(b)

Sample Output:

Datetime representation:
2019-06-01 08:07:57.997800+00:00

Timestamp representation:
1559376477

Python Code Editor:

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous: Write a Python program to search a date from a given string using arrow module.
Next: Write a Python program to extract year, month and date value from current datetime using arrow module.

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.



Follow us on Facebook and Twitter for latest update.