Python Example | Convert Datetime to Timestamp

This python example code shows how to convert python datetime to timestamp.

from datetime import datetime

# current date and time
now = datetime.now()

timestamp = datetime.timestamp(now)
print("timestamp =", timestamp)