I was thinking of the values you would ultimately store in the database and 
what you might use them for eventually. If you want to use these times in a 
SQL expression in the WHERE clause through direct SQL or through DAL 
expressions and search across multiple users for something created between 
time X and Y then they should all be resolved and then stored to the same 
time zone not different ones. In that case you would want to work in UTC on 
the server and then convert using Javascript in the user's browser since the 
user's workstation should have the proper setting for the time zone they are 
in which will trickle down through the browser and the Javascript code to 
convert between UTC and local time for each particular user.

However, since there is no real background for what you want to do with the 
time values from the application perspective it is difficult to advise you 
without some speculation. :-)

Massimo's comment is spot on. The default in the server is to generate the 
time as the local time of the server when the request comes in which again 
would be consistent if all your servers are in the same timezone. To get UTC 
just assign request.now = datetime.utcnow() and use the value consistently.

If you never intend to use the times for comparison across multiple users 
then you can store in the user's local time but I think you will also need 
to store the user's timezone as well to be able to render it back out to the 
user later for display.

Reply via email to