It appears to me that the simplest way to do this is
import datetime
epoch = datetime.datetime.utcfromtimestamp(0)
def unix_time_millis(dt):
return (dt - epoch).total_seconds() * 1000.0
More Related Contents:
- Convert python datetime to epoch with strftime
- In Python, how do you convert seconds since epoch to a `datetime` object?
- Converting epoch time with milliseconds to datetime
- python – datetime with timezone to epoch
- Convert a column of datetimes to epoch in Python
- How to convert epoch time with nanoseconds to human-readable?
- How to convert local time string to UTC?
- How to convert string to datetime format in pandas python?
- how to convert a string date into datetime format in python? [duplicate]
- How to format date string via multiple formats in python
- How do I read a date in Excel format in Python?
- How to truncate the time on a datetime object?
- How do I get the current time in milliseconds in Python?
- Query Mongodb on month, day, year… of a datetime
- Extract day of year and Julian day from a string date
- How to check if the current time is in range in python?
- Comparing two date strings in Python
- Get year, month or day from numpy datetime64
- Why can’t I subclass datetime.date?
- Convert string “Jun 1 2005 1:33PM” into datetime
- Python time to age, part 2: timezones [duplicate]
- Python pandas convert datetime to timestamp effectively through dt accessor
- Which is the fastest way to extract day, month and year from a given date?
- Get time zone information of the system in Python?
- Locate first and last non NaN values in a Pandas DataFrame
- Pandas custom function to find whether it is the 1st, 2nd etc Monday, Tuesday, etc – all suggestions welcome
- Formatting “yesterday’s” date in python
- Get UTC offset from time zone name in python
- Python strptime parsing year without century: assume prior to this year?
- Pandas datetimes with different formats in the same column