Best way to store a python time.struct_time in a mysql database
Question: I am using python's feedparser module, to parse an RSS feed. Once parsed,
feedparser returns dates in a python 9 tuple time format (time.struct_time).

I am want to store these values in my mysql database so I can later check the
[Last-Modified headers](http://www.feedparser.org/docs/http-etag.html) of the
feed. It's import that if the times tuples are converted, that when converted
back they stay the same, so I can later use them for comparison.

I tried this to convert the time tuple to datetime and then back, but it
wasn't the same when converted back:

    
    
    dt = datetime.fromtimestamp(time.mktime(struct))
    time_tuple = dt.timetuple()
    

What do you think is the method to do this?


Answer: Store the datetime as UTC in the database, along with the timezone. Convert
back to a local time when pulling from the database if needed.

