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 Python skills with w3resource's quiz



Python: Tips of the Day

Python: Chaining Of Comparison Operators

Example:

n = 20
test = 1 < n < 30
print(test)

Output:

True

Example:

test = 1 > n <= 9
print(test)

Output:

False