I need to be able to convert time on an time object I recieve from a sql database into python. Here is the current python code I am using without any conversions. I need to add 2 and 1/2 hours to the time.
def getLastReport(self, sql):
self.connectDB()
cursor.execute(sql)
lastReport = cursor.fetchall()
date = lastReport[0][0].strftime('%Y-%m-%d %H:%M UTC')
dataset_id = int(lastReport[0][1])
cursor.close()
DATABASE.close()
return date, dataset_id
Have you looked at the datetime module? http://docs.python.org/library/datetime.html
Convert your SQL time into a datetime, and make a timedelta object of 2.5 hours. Then add the two.