Re: Fractional Hours from datetime?

2010-01-12 Thread Ben Finney
W. eWatson wolftra...@invalid.com writes: See my post about the datetime controversy about 3-4 posts up from yours. This forum is distributed, and there's no “up” or “3-4 messages” that is common for all readers. Could you give the Message-ID for that message? -- \ “As we enjoy great

Re: Fractional Hours from datetime?

2010-01-12 Thread Steve Holden
Alf P. Steinbach wrote: * Steve Holden: Alf P. Steinbach wrote: * W. eWatson: Ben Finney wrote: W. eWatson wolftra...@invalid.com writes: See my post about the datetime controversy about 3-4 posts up from yours. This forum is distributed, and there's no “up” or “3-4 messages” that is

Re: Fractional Hours from datetime?

2010-01-12 Thread Martin P. Hellwig
W. eWatson wrote: cut now = datetime.datetime.now() fractional_hour = now.hour + now.minute / 60.0 See my post about the datetime controversy about 3-4 posts up from yours. If timezones might be a problem area, than it might be worth while to see it in the context of the actual

Re: Fractional Hours from datetime?

2010-01-12 Thread W. eWatson
Ben Finney wrote: Alf P. Steinbach al...@start.no writes: And considering this, and the fact that Google's archive is now the main Usenet archive, message id's are not that useful, really. You've demonstrated only that Google is an unreliable Usenet archive. One doesn't even need to use

Re: Fractional Hours from datetime?

2010-01-11 Thread M.-A. Lemburg
W. eWatson wrote: Maybe there's a more elegant way to do this. I want to express the result of datetime.datetime.now() in fractional hours. Here's one way. dt=datetime.datetime.now() xtup = dt.timetuple() h = xtup[3]+xtup[4]/60.0+xtup[5]/3600.00+xtup[6]/10**6 # now is in fractions of

Re: Fractional Hours from datetime?

2010-01-11 Thread Martin P. Hellwig
W. eWatson wrote: Maybe there's a more elegant way to do this. I want to express the result of datetime.datetime.now() in fractional hours. Here's one way. dt=datetime.datetime.now() xtup = dt.timetuple() h = xtup[3]+xtup[4]/60.0+xtup[5]/3600.00+xtup[6]/10**6 # now is in fractions of an hour

Re: Fractional Hours from datetime?

2010-01-11 Thread Martin P. Hellwig
Martin P. Hellwig wrote: W. eWatson wrote: Maybe there's a more elegant way to do this. I want to express the result of datetime.datetime.now() in fractional hours. Here's one way. dt=datetime.datetime.now() xtup = dt.timetuple() h = xtup[3]+xtup[4]/60.0+xtup[5]/3600.00+xtup[6]/10**6 # now

Re: Fractional Hours from datetime?

2010-01-11 Thread W. eWatson
Austyn wrote: Here's an improvement in case you want your code to work outside of Arizona: from time import time, timezone h = ((time() - timezone) / 3600) % 24 On Jan 10, 9:04 pm, Austyn aus...@gmail.com wrote: How about: import time arizona_utc_offset = -7.00 h = (time.time() / 3600 +

Re: Fractional Hours from datetime?

2010-01-11 Thread W. eWatson
Martin P. Hellwig wrote: Martin P. Hellwig wrote: W. eWatson wrote: Maybe there's a more elegant way to do this. I want to express the result of datetime.datetime.now() in fractional hours. Here's one way. dt=datetime.datetime.now() xtup = dt.timetuple() h =

Re: Fractional Hours from datetime?

2010-01-11 Thread W. eWatson
Martin P. Hellwig wrote: Martin P. Hellwig wrote: W. eWatson wrote: Maybe there's a more elegant way to do this. I want to express the result of datetime.datetime.now() in fractional hours. Here's one way. dt=datetime.datetime.now() xtup = dt.timetuple() h =

Re: Fractional Hours from datetime?

2010-01-11 Thread W. eWatson
Ben Finney wrote: W. eWatson wolftra...@invalid.com writes: See my post about the datetime controversy about 3-4 posts up from yours. This forum is distributed, and there's no “up” or “3-4 messages” that is common for all readers. Could you give the Message-ID for that message? Sort of

Re: Fractional Hours from datetime?

2010-01-11 Thread Ben Finney
W. eWatson wolftra...@invalid.com writes: Ben Finney wrote: Could you give the Message-ID for that message? Sort of like outer space I guess. No real direction. How would I find the message ID? It is a field in the header of every message. Show the full header, and look for the field

Re: Fractional Hours from datetime?

2010-01-11 Thread Alf P. Steinbach
* W. eWatson: Ben Finney wrote: W. eWatson wolftra...@invalid.com writes: See my post about the datetime controversy about 3-4 posts up from yours. This forum is distributed, and there's no “up” or “3-4 messages” that is common for all readers. Could you give the Message-ID for that

Re: Fractional Hours from datetime?

2010-01-11 Thread Steve Holden
Alf P. Steinbach wrote: * W. eWatson: Ben Finney wrote: W. eWatson wolftra...@invalid.com writes: See my post about the datetime controversy about 3-4 posts up from yours. This forum is distributed, and there's no “up” or “3-4 messages” that is common for all readers. Could you give the

Re: Fractional Hours from datetime?

2010-01-11 Thread Ben Finney
Alf P. Steinbach al...@start.no writes: And considering this, and the fact that Google's archive is now the main Usenet archive, message id's are not that useful, really. You've demonstrated only that Google is an unreliable Usenet archive. One doesn't even need to use Usenet, in this case,

Re: Fractional Hours from datetime?

2010-01-11 Thread David Robinow
On Mon, Jan 11, 2010 at 10:26 PM, Ben Finney ben+pyt...@benfinney.id.au wrote: Alf P. Steinbach al...@start.no writes: And considering this, and the fact that Google's archive is now the main Usenet archive, message id's are not that useful, really. You've demonstrated only that Google is an

Re: Fractional Hours from datetime?

2010-01-11 Thread Alf P. Steinbach
* Steve Holden: Alf P. Steinbach wrote: * W. eWatson: Ben Finney wrote: W. eWatson wolftra...@invalid.com writes: See my post about the datetime controversy about 3-4 posts up from yours. This forum is distributed, and there's no “up” or “3-4 messages” that is common for all readers.

Fractional Hours from datetime?

2010-01-10 Thread W. eWatson
Maybe there's a more elegant way to do this. I want to express the result of datetime.datetime.now() in fractional hours. Here's one way. dt=datetime.datetime.now() xtup = dt.timetuple() h = xtup[3]+xtup[4]/60.0+xtup[5]/3600.00+xtup[6]/10**6 # now is in fractions of an hour --

Re: Fractional Hours from datetime?

2010-01-10 Thread Austyn
How about: import time arizona_utc_offset = -7.00 h = (time.time() / 3600 + arizona_utc_offset) % 24 dt.timetuple()[6] is the day of the week; struct tm_time doesn't include a sub-second field. On Jan 10, 10:28 am, W. eWatson wolftra...@invalid.com wrote: Maybe there's a more elegant way to do

Re: Fractional Hours from datetime?

2010-01-10 Thread Austyn
Here's an improvement in case you want your code to work outside of Arizona: from time import time, timezone h = ((time() - timezone) / 3600) % 24 On Jan 10, 9:04 pm, Austyn aus...@gmail.com wrote: How about: import time arizona_utc_offset = -7.00 h = (time.time() / 3600 +