Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a script that I want to have an if statement check if a file falls between several specified date periods as it searches directories. I have been able to get the time in %Y-%m-%d format for the file, but I can't seem to be able to specify a date range for python to go through. Any ideas/help?

Here's what I have so far

for name in files:
    f = os.path.join(root, name)
    dt = os.path.getmtime(f)
    nwdt = time.gmtime(dt)
    ndt = time.strftime('%Y-%m-%d', nwdt)
share|improve this question

closed as off-topic by Karan, Ignacio Vazquez-Abrams, gronostaj, grawity, Louis Jul 2 '13 at 0:12

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about software development are off-topic here, but can be asked on Stack Overflow." – Karan, Ignacio Vazquez-Abrams, gronostaj, grawity, Louis
If this question can be reworded to fit the rules in the help center, please edit the question.

    
This is off-topic, and should be on Stack Overflow instead of Super User – ernie Jul 1 '13 at 21:48
if datetime.datetime(...) < datetime.datetime.utcfromtimestamp(dt) < datetime.datetime(...):
   ...
share|improve this answer

Not the answer you're looking for? Browse other questions tagged .