file time datetime


/ Published in: Python
Save to your folder(s)



Copy this code and paste it in your HTML
  1. # recupete le mtime d'un fichier
  2. import os
  3. file="c:\gce.png"
  4. mtime = os.stat(file).st_mtime
  5.  
  6. # le transforme en time
  7. import time
  8. print time.localtime(mtime)
  9.  
  10. # le transforme en datetime
  11. import datetime
  12. print datetime.datetime.fromtimestamp(mtime)

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.