On 30 Jul 2014, at 1:47am, Will Fong <w...@digitaldev.com> wrote: > On Wed, Jul 30, 2014 at 8:38 AM, Simon Slavin <slav...@bigfraud.org> wrote: >> Store their timezones in the format "[+-]HH:MM" and apply them by appending >> that text to any dates they provide. See the "Time Strings" section of > > I can store each user's timezone setting as "[+-]HH:MM". But I can > only apply that to GMT values.
The SQLite routines will apply those timezones to any times. You just append them to the time string you supply to the routines. > So when I'm reading from the database, > it's a trivial operation. > > However, if a user specifies a datetime, I would have to provide the > reverse of that value to convert the user time into GMT. It would be a > bit easier (yet still messy) if the timezone was just an integer, then > I could just "*-1". But the ":MM" seems to make it a messy string > operation. > > Is this the only option? It seems like there would have been a > "better" way to handle this. I would probably write a library routine which converted the zone in the form the user supplies it (+3, -9, GMT, +0, whatever) to the form I wanted it "[+-]HH:MM", and I'd store both of them /and/ a copy of "[+-]HH:MM" with the sign reversed. Alternatively, you can provide your users with a popup, but deduce all three forms from whatever value they picked in the popup. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users