0

I have following query,

SELECT UNIX_TIMESTAMP() - UNIX_TIMESTAMP(rc_timestamp) AS LAG_TIME FROM recentchanges ORDER BY rc_timestamp DESC LIMIT 1

In my python code I am trying to get it to convert into seconds, but what I am currently getting is following:

{'LAG_TIME': 32L}

I tried with utf but results is same.

getLagTime = ur"""SELECT UNIX_TIMESTAMP() - UNIX_TIMESTAMP(rc_timestamp) AS LAG_TIME FROM recentchanges ORDER BY rc_timestamp DESC LIMIT 1"""
cursor.execute(getLagTime)
lagTime = cursor.fetchall()
for time in lagTime:
    print time
    print unicode(time['LAG_TIME'], 'utf-8', error='strict')
2
  • Add your python code to the question. Commented Feb 10, 2012 at 7:15
  • I updated the code, its a tiny fraction of a very lengthy code. Commented Feb 10, 2012 at 17:50

1 Answer 1

3

I guess you already have the answer: 32 seconds. Don't get confused by the "L". It tells you, that this is a long value, and not an int.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.