Answer the question
In order to leave comments, you need to log in
How to do time recalculation in MySQL and PostgreSQL?
I had such a script for sqlite:
Date=`/usr/bin/sqlite3 /var/somedb/some.db "select datetime('now')"`
Date_db_dump=`/usr/bin/sqlite3 /var/somedb/some.db "select datetime(ts, 'unixepoch') from some_table order by ts DESC limit 1"`
Date_dif=`/usr/bin/sqlite3 /var/somedb/some.db "SELECT strftime('%s','$Date') - strftime('%s','$Date_db_dump') "`
`/usr/bin/sqlite3 /var/somedb/some.db "update some_table set ts = ts + $Date_dif"`
`/usr/bin/sqlite3 /var/somedb/some.db "update some_table set ts = ts + $Date_dif"`
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question