Re: Converting from local -> UTC

2008-07-18 Thread M.-A. Lemburg
On 2008-07-18 05:28, Dennis Lee Bieber wrote: On Thu, 17 Jul 2008 20:26:11 -0300, "Gabriel Genellina" <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: Note that I used %s everywhere (it's just a placeholder, not a format) and Unfortunately, in the case of M

Re: Converting from local -> UTC

2008-07-17 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Gabriel Genellina wrote: > Note that I used %s everywhere (it's just a placeholder, not a format) ... >From /usr/lib64/python2.5/site-packages/MySQLdb/cursors.py, lines 150-151: if args is not None: query = query % db.literal(args) -- http://mail.pytho

Re: Converting from local -> UTC

2008-07-17 Thread Gabriel Genellina
En Wed, 16 Jul 2008 15:00:50 -0300, Keith Hughitt <[EMAIL PROTECTED]> escribi�: Thanks Gabriel! That helps clear things up for me. The above method works very well. I only have one remaining question: How can I pass a datetime object to MySQL?' So far, what I've been doing is building the qu

Re: Converting from local -> UTC

2008-07-17 Thread M.-A. Lemburg
On 2008-07-17 22:43, Dennis Lee Bieber wrote: On Thu, 17 Jul 2008 19:55:44 +0200, "M.-A. Lemburg" <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: Use binding parameters and it should work: query = "INSERT INTO image VALUES(%d, %d, %s, '%s')" If this is MySQLdb inter

Re: Converting from local -> UTC

2008-07-17 Thread M.-A. Lemburg
On 2008-07-16 20:00, Keith Hughitt wrote: Thanks Gabriel! That helps clear things up for me. The above method works very well. I only have one remaining question: How can I pass a datetime object to MySQL?' So far, what I've been doing is building the query as a string, for example: query = "I

Re: Converting from local -> UTC

2008-07-16 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Keith Hughitt wrote: > I have a UTC date (e.g. 2008-07-11 00:00:00). I would like to create a > UTC date ... >>> import calendar >>> calendar.timegm((2008, 7, 11, 0, 0, 0, 0, 0, -1)) 1215734400 [EMAIL PROTECTED]> TZ=NZ date -d "00:00:00 01-Jan-1970Z +1215734400 s

Re: Converting from local -> UTC

2008-07-16 Thread Keith Hughitt
Thanks Gabriel! That helps clear things up for me. The above method works very well. I only have one remaining question: How can I pass a datetime object to MySQL?' So far, what I've been doing is building the query as a string, for example: query = "INSERT INTO image VALUES(%d, %d, %s, '%s')" %

Re: Converting from local -> UTC

2008-07-14 Thread Gabriel Genellina
En Mon, 14 Jul 2008 12:06:30 -0300, Keith Hughitt <[EMAIL PROTECTED]> escribió: On Jul 12, 12:52 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: En Fri, 11 Jul 2008 15:42:37 -0300, Keith Hughitt   <[EMAIL PROTECTED]> escribió: > I am having a little trouble figuring out how to convert a pyt

Re: Converting from local -> UTC

2008-07-14 Thread Keith Hughitt
On Jul 12, 12:52 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Fri, 11 Jul 2008 15:42:37 -0300, Keith Hughitt   > <[EMAIL PROTECTED]> escribi�: > > > I am having a little trouble figuring out how to convert a python > > datetime to UTC. I have a UTC date (e.g. 2008-07-11 00:00:00). I woul

Re: Converting from local -> UTC

2008-07-12 Thread Sebastian "lunar" Wiesner
Gabriel Genellina <[EMAIL PROTECTED]>: > En Fri, 11 Jul 2008 15:42:37 -0300, Keith Hughitt > <[EMAIL PROTECTED]> escribi�: > >> I am having a little trouble figuring out how to convert a python >> datetime to UTC. I have a UTC date (e.g. 2008-07-11 00:00:00). I would >> like to create a UTC date

Re: Converting from local -> UTC

2008-07-11 Thread Gabriel Genellina
En Fri, 11 Jul 2008 15:42:37 -0300, Keith Hughitt <[EMAIL PROTECTED]> escribi�: I am having a little trouble figuring out how to convert a python datetime to UTC. I have a UTC date (e.g. 2008-07-11 00:00:00). I would like to create a UTC date so that when I send it to MySQL (which treats all d

Converting from local -> UTC

2008-07-11 Thread Keith Hughitt
Hi, I am having a little trouble figuring out how to convert a python datetime to UTC. I have a UTC date (e.g. 2008-07-11 00:00:00). I would like to create a UTC date so that when I send it to MySQL (which treats all dates at local dates by default), it will already have incorporated the proper UT