Thanks Andrew, I was able to get this working for my current timezone using 
datetime and timedelta.  I'm still new at this so if anyone has a better 
way or can get this working for all users anywhere instead of just people 
in my time zone that would be awesome.  

On Monday, March 4, 2013 3:06:43 PM UTC-5, Andrew Evans wrote:
>
> Hi I did something I think which is similar
>
> you can get the current time based on time zone like this
>
> import datetime
> import pytz
> import time
>
> current_time = 
> datetime.datetime.now(pytz.timezone('US/Eastern')).replace(tzinfo=None)
>
> This allowed me to schedule videos to play at a given time
>
> Not sure this is what you need but maybe it helps :-)
>
> *cheers
>
> Andrew
>
> On Mon, Mar 4, 2013 at 11:57 AM, Niphlod <[email protected] 
> <javascript:>>wrote:
>
>> no, it's not possible. request.now is always calculated on the server, 
>> not on the client. That being said, the "today" on the server may not be 
>> the same today on the clients accessing your page from all the timezones in 
>> the world....
>> e.g. if you're providing some kind of function based on THEIR timezone 
>> (i.e. "press this button to delete all your appointments today") you really 
>> need to start fiddling with UTC and timezone differences.
>>
>>
>> On Monday, March 4, 2013 7:08:23 PM UTC+1, jjg0 wrote:
>>>
>>> I had asked a question about comparing datetimes here: 
>>> https://groups.google.com/**forum/?fromgroups=#!topic/**
>>> web2py/2euU80vV2WE<https://groups.google.com/forum/?fromgroups=#!topic/web2py/2euU80vV2WE>
>>> The question was answered but I ran into another problem closely 
>>> related, so I made a sequel.  Let's hope we don't have to suffer through a 
>>> trilogy!
>>>
>>> Here is what I am doing:
>>>
>>> I have a model of appointments with a field for the date:
>>>
>>> .
>>> .
>>> Field('appointment_date', 'date') 
>>> .
>>> .<other fields>
>>>
>>> and a controller that should grab all of today's appointments to be 
>>> printed out:
>>>
>>> appointment_dates = db(db.appointments.**appointment_date==request.now.*
>>> *date()).select()
>>>
>>> Here is the problem:
>>>
>>> request.now.date() appears to get the time based on the server.  So If 
>>> the server is say 5 hours ahead, once 7:00pm my time hits I'm going to be 
>>> looking at tomorrows appointments.  (server hits midnight, day cycles but 
>>> I'm still 7:00pm yesterday)
>>>
>>> When the controller goes to grab the day's appontments, is it possible 
>>> to somehow replace request.now.date() with the date of the users pc?  
>>> Otherwise I'm not really sure how else to go about this problem.  
>>>
>>> Thanks
>>>
>>>
>>>  -- 
>>  
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to