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 cue the beer commercial

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 =

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 interface:

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

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) --

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-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 seconds Fri

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 so that when

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

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