On 10/22/08, jonwood <[EMAIL PROTECTED]> wrote:
>
>
>  P Kishor-3 wrote:
>  >
>  > I thought it was very clearly indicated in one of the answers in this
>  > thread on how to do that. Here it is again...
>  >
>  > datetime('now', 'localtime')
>  >
>
>
> Yes, that was the answer. And it was implemented in my application within
>  moments of being posted. The discussion has since moved on to different
>  things.
>


Well, I have been reading the thread as well, and I am quite aware of
where the discussion has moved to.

You asked

> Yeah, I appreciate the discussion of UTC. Although I don't fully understand
>  how to convert UTC to local time on a Website, I do some Web development and
>  so I can imagine scenarios where they may be appropriate.
>

in which I see two questions (I quote below but have numbered the questions) --

1. I don't fully understand how to convert UTC to local time?
2. on a Website

The answer to #1 is datetime(<UTC time>, 'localtime') which you say
you have already implemented, so I am assuming you do understand how
to convert UTC to local time. Hence, #1 above is a non-question.

The answer to #2 is what I tried to allude in my discussion... "on a
Website" is not a clear articulation of the problem. Here are three
scenarios --

a. If you simply want to display on a web page, time local to the
viewer viewing the web page, you use JavaScript to show the user's
computer's time.

b. On the other hand, if you want to display on the web page, time
local to the viewer viewing the web page, but for a time stored in
your web server for some row that you inserted or modified, then you
use the <time in UTC stored in your webserver>, send it to the web
page, and convert it there into user's local time using JavaScript.

c. If you want to display <time in UTC stored in your webserver> but
as time local to your webserver, you use datetime(<time in UTC stored
in your webserver>, 'localtime') and send it to your web page as is.

d. If you want to display <time in UTC stored in your webserver> but
as time local to you, well... I leave that and other combinations for
you to solve.

In all of these, storing time at UTC allows you to manipulate time for
display *at the time of extracting it from the db* without any
ambiguities about what time is being displayed.

Hope this helps.

-- 
Puneet Kishor http://punkish.eidesis.org/
Nelson Institute for Environmental Studies http://www.nelson.wisc.edu/
Open Source Geospatial Foundation (OSGeo) http://www.osgeo.org/
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to