First, be careful with modifying a database you don't control.  This can
result in unexpected results, even if you're tailing onto the end of the
table.  Some calls are like [select * from ThisTable] and the code itself
is expecting exactly the number of fields to be returned.  You may also be
creating a field that might be used somewhere else in the code as an alias,
to which could cause ambiguous errors (Meaning, the code doesn't know which
date2 you're referencing).

Second, it'll depend on what the date1 field contains.  When you say "linux
time", as that phrase sits, I can think of two or three different methods
'Nix flavors display date and time values.

Date/Time functions can be found here:
https://sqlite.org/lang_datefunc.html

If you can show us a subset of records, and what the fields contain, we can
probably come up with a decent query to do a one-time update command (Or
periodic since the code doesn't know how to deal with your new field,
although, you could put in a trigger to automatically update after the
record was inserted)


On Sat, Dec 23, 2017 at 11:34 PM, Miel Loinaz <mloina...@gmail.com> wrote:

> Hello,
> I want to modify a sqlite database of a weather station software
> (wewx.sdb). Date
> and time are in the form of echo or linux time (field date1). I have added
> a new field (date2) where I want to display human readable date and time.
>
> In Linux console I get it running:
>
> UPDATE table1 SET date2 = datetime (date1, 'unixepoch', 'localtime');
>
> But I do not know how to modify the sqlite database with DB Browser, I'm a
> newbie. Where should I enter this code?
>
> Thanks and Merry Christmas!
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to