Use SQL timestamps whenever possible, and don't store UNIX timestamps in the database at all.
Scripts for rlgallery.org, using a PostgreSQL backend. The recorder system is in py/, CGI scripts are in web/.