Generation time vs viewing time
import os
import time
# Write an HTML file to directory 'folder'.
# Danger: New file is called 'time.html'. Any file with that name
# will be overwritten without warning!
def timePage(folder):
pageFileName = folder + os.sep + "time.html"
file = open(pageFileName, "wt")
file.write("<html><head><title>Time</title></head><body>")
# Find time at which page is *created* using Python time module
file.write("<p>This page was created on " + time.ctime() + "</p>")
# Create Javascript text that will find current time when page is *viewed*
currentTimeHTML = "<script>document.write(Date());</script>"
file.write("<p>The current time is " + currentTimeHTML + "</p>")
file.write("</body></html>")
file.close()
Link to this Page