python datetime unix timestamp code example
Example 1: php datetime object get unix timestamp
$date = new DateTime();
echo $date->getTimestamp();
Example 2: how to get unix timestamp in python
import time
time.time()
Example 3: get datetime from unix timestamp python3
from datetime import datetime
timestamp = 1545730073
dt_object = datetime.fromtimestamp(timestamp)
print("dt_object =", dt_object)
print("type(dt_object) =", type(dt_object))
Example 4: pandas datetime to unix timestamp
dates = pd.to_datetime(['2019-01-15 13:30:00'])
(dates - pd.Timestamp("1970-01-01")) // pd.Timedelta('1s')