Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8260131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:01:28+00:00 2026-06-08T03:01:28+00:00

I was browsing the Python guide and some search machines for a few hours

  • 0

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.

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.

In my loop I do the following code to get its micro time:

file_time = os.path.getmtime(path + file_name)

This returns me a nice micro time, like this: 1342715246.0

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.

# 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 > self.start_time:
    file_list.append(file_name)

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T03:01:29+00:00Added an answer on June 8, 2026 at 3:01 am

    Take a look at Python datetime to microtime. You need the following snippet:

    def microtime(dt):
        time.mktime(dt.timetuple()) + dt.microsecond / 1000000.0 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Been browsing the questions and Googling it but I can't seem to find a
I originally posted this question looking for an answer with using python, got some
browsing some html code I find a text input coded as: <input type=text name=Email<%=orderRow.ID
Related: What is the common header format of Python files? Where can I find
After browsing for several hours, I'm completely stumped on how to prevent Windows 7
I have been browsing through Google for various explanations but I STILL couldn't figure
I'm really new to programming, and creating programs. Recently I was browsing around iTunes
This may be closed, a couple of minutes from now, but I think I
Browsing through some C++ questions I have often seen comments that a STL-friendly class
I was browsing over the net for some information about CryptUnprotectData and WZC. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.