Fixed quotes in SQL statements, and Date for timestamping snapshots

There were quotes in the wrong places for SQL statements, which made those operations fail. For example, no snapshots after "create" were ever saved. Fixed.

Also, all new snapshots were saved with timestamp 0000-00-00 00:00:00. Now it's correct.