On Jul 23, 8:52 pm, MRAB wrote:
> > dt_twothirty=dt_localtime.replace(hour=settings.UPDATE_TIME_HOURS,minute=se
> > ttings.UPDATE_TIME_MINS,second=0,microsecond=0)
>
> You're changing the time of day, but not the date. You might want to add
> a day to the shutdown time if it's earlier than the cu
On 7/23/2010 10:01 AM, Jim wrote:
How can I calculate how much time is between now and the next 2:30
am? Naturally I want the system to worry about leap years, etc.
Thanks,
Jim
DAYSECS = 24*60*60
GOALSECS = (2*60 + 30)*60
now = (GOALSECS + DAYSECS - (int(time.time()) % DAYSECS)) % DA
Jim wrote:
Thank you again to everyone; I greatly appreciate the help. I ended
with essentially what Christian advised and it seems to work fine.
FWIW, below is the rouine (I couldn't figure out how to do it without
the kludgy x variable). The background is that this is a Django
context process
Thank you again to everyone; I greatly appreciate the help. I ended
with essentially what Christian advised and it seems to work fine.
FWIW, below is the rouine (I couldn't figure out how to do it without
the kludgy x variable). The background is that this is a Django
context processor that makes
> Your case could be handled by something like:
>
> from datetime import datetime
> from dateutil.relativedelta import relativedelta
>
> target = datetime.now() + relativedelta(days=+1, hour=2, minute=30,
> second=0, microsecond=0)
> rem
Neil Cerutti writes:
> On 2010-07-23, Jim wrote:
>> How can I calculate how much time is between now and the next
>> 2:30 am? Naturally I want the system to worry about leap
>> years, etc.
>
> You need the datetime module. Specifically, a datetime and
> timedelta object.
Although it sounds lik
Thanks; I'll have a look, and a think.
Jim
--
http://mail.python.org/mailman/listinfo/python-list
On 2010-07-23, Jim wrote:
> How can I calculate how much time is between now and the next
> 2:30 am? Naturally I want the system to worry about leap
> years, etc.
You need the datetime module. Specifically, a datetime and
timedelta object.
--
Neil Cerutti
--
http://mail.python.org/mailman/lis
How can I calculate how much time is between now and the next 2:30
am? Naturally I want the system to worry about leap years, etc.
Thanks,
Jim
--
http://mail.python.org/mailman/listinfo/python-list