Python get micro time from certain date <p>I was browsing the Python guide and some search machines for a few hours now, but I can't really find an answer to my question.</p> <p>I am writing a switch where only certain files are chosen to be in the a file_list (list[]) when they are modified after a given date.</p> <p>In my loop I do the following code to get its micro time:</p> <pre><code>file_time = os.path.getmtime(path + file_name) </code></pre> <p>This returns me a nice micro time, like this: 1342715246.0</p> <p>Now I want to compare if that time is after a certain date-time I give up. So for testing purposes, I used 1790:01:01 00:00:00.</p> <pre><code># Preset (outside the class/object) start_time = '1970-01-01 00:00:00' start_time = datetime.datetime.strptime(start_time, '%Y-%m-%d %H:%M:%S') start_time = start_time.strftime("%Y-%m-%d %H:%M:%S") # In my Method this check makes sure I only append files to the list # that are modified after the given date if file_time &gt; self.start_time: file_list.append(file_name) </code></pre> <p>Of course this does not work, haha :P. What I'm aiming for is to make a micro time format from a custom date. I can only find ClassMethods online that make micro time formats from the current date.</p>