title: In Python: How to Return "Windows" Created Time of a File?
body: <hr>
  
  <p><strong>Thsi question is edited with new information further below:</strong></p>
  
  <hr>
  
  <p>I am on Windows 7 Machine using Cygwin.. and I have both Python 2.6 and 3.1 installed.</p>
  
  <p>I can see the following using my short python script.. for Created Time, Modified Time, Access Time and Created Time using stat.</p>
  
  <p>But, the problem is that.. Windows 7 File Properties shows Created Time as <strong>11/12/2010 11:57:54 AM</strong>.</p>
  
  <p><strong>My question is:
  How can I return the Windows Created Time in a python script.</strong></p>
  
  <p><strong>I repeat I don't want to see the <code>fctime</code> as returned in the script below. It is NOT the same as Windows Created Time.</strong></p>
  
  <p>Please advise how I can do this.. and why is there a difference.. please explain.</p>
  
  <p>Yes.. and I have read the documentation for os.stat.. and it says:</p>
  
  <blockquote>
    <p>st_ctime (platform dependent; time of
    most recent metadata change on Unix,
    or the time of creation on Windows):</p>
  </blockquote>
  
  <pre><code>$ python /tmp/python/filemodified.py marksix.py
  marksix.py
  fctime: 11/12/2010 22:58:25
  fmtime: 11/12/2010 22:57:01 (windows shows 22:57:01 ok)
  fatime: 11/12/2010 22:45:21 (windows shows 22:45:21 ok)
  fctimestat: Sat Dec 11 22:58:25 2010 (same as above fctime)
  fsize: 1765
  </code></pre>
  
  <p>some what related to this posting: <a href="https://stackoverflow.com/questions/946967/get-file-creation-time-with-python-on-mac">Get file creation time with Python on Mac</a></p>
  
  <p>Here is my full script:</p>
  
  <pre><code>import sys
  import os
  import time
  
  for f in sys.argv[1:]:
      if os.path.exists(f):
  
          fname = f
          fctime = time.strftime("%d/%m/%Y %H:%M:%S",time.localtime(os.path.getctime(fname)))
          fmtime =  time.strftime("%d/%m/%Y %H:%M:%S",time.localtime(os.path.getmtime(fname)))
          fatime =  time.strftime("%d/%m/%Y %H:%M:%S",time.localtime(os.path.getatime(fname)))
          fsize = os.path.getsize(fname)
          #print "size = %0.1f kb" % float(fsize/1000.0)
          fctimestat = time.ctime(os.stat(fname).st_ctime)
  
          print fname + '\nfctime: ' + fctime + '\nfmtime: ' + fmtime + '\nfatime: ' + fatime + '\n',
          print 'fctimestat: ' + fctimestat + '\n',
          print 'fsize:', fsize,
          print
  </code></pre>
  
  <hr>
  
  <p><strong><em>Additional Info:</em></strong></p>
  
  <p>Now.. I am in my work environment.. so I can't use the same file as before.. but anyway, I tested with cygwin python (2.6.5) and windows python (2.6.6).. and the results are different.. as can be seen below.</p>
  
  <p>First one is cygwin Python.. and second one is Windows Python. And, Windows Python matches the File Properties... So, is this difference normal..? Why should cygwin python get the same set of dates as Windows..?</p>
  
  <pre><code>User@COMP /tmp/pythonscr
  $ python file_time.py ../testjpg.gif
  ../testjpg.gif
  fctime: 05/01/2011 10:25:52
  fmtime: 05/01/2011 10:25:52
  fatime: 01/12/2010 17:30:16
  fctimestat: Wed Jan  5 10:25:52 2011
  fsize: 1536
  ------
  
  
  User@COMP /tmp/pythonscr
  $ /cygdrive/c/Python26/python.exe file_time.py ../testjpg.gif
  ../testjpg.gif
  fctime: 01/12/2010 17:30:16
  fmtime: 05/01/2011 10:25:52
  fatime: 01/12/2010 17:30:16
  fctimestat: Wed Dec 01 17:30:16 2010
  fsize: 1536
  ------
  </code></pre>