Use time structure : Date Time « Development « Python






Use time structure

Use time structure

import time
gmt = time.gmtime(time.time())
fmt = '%a, %d %b %Y %H:%M:%S GMT'
str = time.strftime(fmt, gmt)
hdr = 'Date: ' + str
print hdr

           
       








Related examples in the same category

1.Dates are easily constructed and formattedDates are easily constructed and formatted
2.Dates support calendar arithmeticDates support calendar arithmetic
3.Print out a date, given year, month, and day as numbersPrint out a date, given year, month, and day as numbers
4.Define your own class to store time and date
5.Define class to use system time class