On 2014-07-29, 8:23 PM, Will Fong wrote:
Hi,

On Wed, Jul 30, 2014 at 8:16 AM, Igor Tandetnik <i...@tandetnik.org> wrote:
'localtime' and 'utc' modifiers.

Ah! I have not explained my issue properly :)  I'm very sorry about that.

I'm using SQLite as a backend to a small website and I have users in
multiple timezones. When users login, their timezone is retrieved from
the user table.

Really sorry for the confusion. Late night.

I'd suggest a view on the data that does the conversion. You can also use an INSTEAD OF trigger for insertion:

CREATE VIEW user_data_view AS
  SELECT *,to_user_tz(gmt_time,user_tz)
  FROM user_data_view;

When I need to care about timezones, I always store them as GMT and only convert them when I need to present them to the user. This makes math and comparisons on dates easy.

Fortunately, my applications are usually designed in a manner that there are very few lines of code needed to support these to/from conversions.

Sohail


_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to