Actually it isn't that obvious. In Python the datetime class by default is 
not time zone aware. If you have users coming from multiple time zones the 
best universal way to handle this is store the time in UTC which the 
datetime class has a method for datetime.utcnow(). This is how UNIX does it 
internally and then warps the time to the local time of the user based on 
their environment variable setting. If you don't do this then time 
comparisons across users become a real bear to deal with. If you have all 
the users on one server it will be the server time that is used to fill the 
database fields if you use datetime.now() instead so you might be able to 
manage it that way. The browser client through Javascript knows the timezone 
of the client and without being specific I believe there is a way to get 
from UTC to local time in Javascript. So again it comes back to using UTC on 
the server for the least effort over all.

Hope that helps
Ron


Reply via email to