I want to retrieve time in the format of "HH:MM" from datetime.timedelta object. I have a table stored in MySQL database. It has time column, which has stored the time in the format,
00:00:00
I have connected to MySQL server using PyMySQL module,
conn = pymysql.connect("localhost", "root", "cloudera", "streaming")
cursor = conn.cursor()
sql = "select * from table1 limit 5;"
cursor.execute(sql)
row = cursor.fetchone()
row[1]
Output is,
datetime.timedelta(0)
I have been through this post Python: How do I get time from a datetime.timedelta object?. But the difference from that question and mine is in output result. For that post, output is
datetime.timedelta(0, 64800)
And for me it is just,
datetime.timedelta(0)
I just don't get it why the output for me is that way. Can anyone please help me in retrieving time. Thanks in advance.