Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #5471
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!selfless.tophat.at!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.011 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'python.': 0.05; 'instance,': 0.05; 'function,': 0.07; '(it': 0.09; 'exceeds': 0.09; 'seconds': 0.11; 'this:': 0.11; 'am,': 0.14; 'wrote:': 0.14; 'retrieving': 0.16; 'seconds,': 0.16; 'subject:function': 0.16; 'suits': 0.16; '16,': 0.16; 'subject:skip:d 10': 0.18; 'header:In- Reply-To:1': 0.22; 'mon,': 0.22; 'values': 0.23; 'integer': 0.23; 'received:209.85.214.174': 0.23; 'received:mail- iw0-f174.google.com': 0.23; 'nov': 0.24; 'format,': 0.25; 'library.': 0.25; "i'm": 0.26; 'chris': 0.27; 'message- id:@mail.gmail.com': 0.28; "doesn't": 0.28; "python's": 0.29; 'query': 0.29; 'selecting': 0.31; 'situation,': 0.31; 'to:addr :python-list': 0.32; 'using': 0.34; 'actually': 0.34; 'got': 0.34; 'sense,': 0.35; 'data': 0.37; 'some': 0.37; 'it?': 0.37; 'received:209.85': 0.37; 'received:google.com': 0.38; 'database': 0.38; 'received:209.85.214': 0.39; 'to:addr:python.org': 0.39; 'could': 0.39; 'received:209': 0.39; 'add': 0.39; 'whatever': 0.39; 'header:Received:5': 0.40; 'you.': 0.61; '2011': 0.62; 'maximum': 0.62; 'march': 0.66; '16th': 0.84; 'flexibility,': 0.84; 'jorge': 0.84; 'subject:class': 0.84; 'summing': 0.84; 'presumably': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=AzMnSLffMJGBaf3kX3Y0lHLY8CtAv6PcTwOGYROkEpA=; b=cLXAaqDdSbVurRoPk9qn7Czu6hFkrJbQAuhd3bRWxrO56Ncj4ugQ6NGSqEnqOiRVmH ittnLDHmB2JOKO0avSZssWI8MR8Gp8JV92dvMgPr7vBdbhM6il/iuV+U1oDCRliEM6JM PFmIkP1JsUFykDbcdh8Wfc5hVjRboATlmtu1s= |
| DomainKey-Signature | a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=HQzck4t9f4FKp3HJ1bq6xIunQ2YaoTz5RXatRAU6let2kAb3FdQUFRviu4mzXFYKjK 2pUE50Q3AYPm92EqYo59GcYXVG7hkIU+lAjUXRhk9mRwgdPPSb17WEj9KU5tV6tz0aLL U4NSvBEM1A3AD+H5bzwV9PupMi1fr8To4wVDo= |
| MIME-Version | 1.0 |
| In-Reply-To | <BANLkTimRx5oc+iRfxDDEe7R-UR30H8R=ZQ@mail.gmail.com> |
| References | <BANLkTimRx5oc+iRfxDDEe7R-UR30H8R=ZQ@mail.gmail.com> |
| Date | Mon, 16 May 2011 13:50:05 +1000 |
| Subject | Re: MySQLdb SEC_TO_TIME function returns datetime.timedelta class |
| From | Chris Angelico <rosuav@gmail.com> |
| To | python-list@python.org |
| Content-Type | text/plain; charset=ISO-8859-1 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1615.1305517814.9059.python-list@python.org> (permalink) |
| Lines | 18 |
| NNTP-Posting-Host | 82.94.164.166 |
| X-Trace | 1305517814 news.xs4all.nl 81474 [::ffff:82.94.164.166]:50689 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:5471 |
Show key headers only | View raw
On Mon, May 16, 2011 at 10:42 AM, Jorge Romero <jorgeromero178@gmail.com> wrote: > Hi Pythonists, > I'm retrieving some time data from a MySQL database using Python's MySQLdb > library. Here's the situation, I got a time field on MySQL given in seconds, > I need it on HH:MM:SS format, so I'm SELECTING that field with SEC_TO_TIME > function, something like this: > query = "SELECT SEC_TO_TIME(SUM(seconds)) FROM table" You're summing a column, so presumably the values are actually deltas (it doesn't make sense, for instance, to add Tues March 16th to Sat Nov 2nd). The result exceeds a day; in what format do you actually want it? For maximum flexibility, you could ditch the SEC_TO_TIME call and simply work with the integer seconds in Python. You can then format that into HHHHH:MM:SS or whatever suits you. Chris Angelico
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: MySQLdb SEC_TO_TIME function returns datetime.timedelta class Chris Angelico <rosuav@gmail.com> - 2011-05-16 13:50 +1000
csiph-web