timestamp
Is it possible to define a timestamp column that is not null and has no default and no special behavior on update?
Timestamp columns are a special case. See here: By default, TIMESTAMP columns are NOT NULL, cannot contain NULL values, and assigning NULL assigns the current timestamp. For more detailed information read up on Data Type Default Values. Specifically that situation applies when not running in strict mode. If running in strict mode, inserting a NULL … Read more
MySQL column type “TIMESTAMP” implicitly includes “NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP”
In MySQL 5.6.5 there are several updates regarding this initialization, you can see on this link (Automatic Timestamp Properties Before MySQL 5.6.5). If you’re using MySQL <= 5.6.5, in order to ignore this initialization you need to set the DEFAULT value to 0 or NULL with NULL allowed. CREATE TABLE tbl ( field1 TIMESTAMP DEFAULT … Read more
Which date class should I use in Java 8?
Each one of the Date classes are for specific purposes: If you want to use your Date in an SQL/JDBC context, use the java.sql.Timestamp. java.util.Date is the old Java API, it is not thread safe, you can difficultly handle time zoning, and on the top of all, it is poorly designed: one simple uniformity is … Read more
postgreSQL alter column data type to timestamp without time zone
If create_time is of type TEXT with valid date value, it’ll be easier to proceed with the change as follows (Be advised to first do a table dump as a backup): — Create a temporary TIMESTAMP column ALTER TABLE AB ADD COLUMN create_time_holder TIMESTAMP without time zone NULL; — Copy casted value over to the … Read more
SQL Server RowVersion/Timestamp – Comparisons
From MSDN: Each database has a counter that is incremented for each insert or update operation that is performed on a table that contains a rowversion column within the database. This counter is the database rowversion. This tracks a relative time within a database, not an actual time that can be associated with a clock. … Read more
Convert Unix timestamp to a readable date in Perl
Quick shell one-liner: perl -le ‘print scalar localtime 1357810480;’ Thu Jan 10 10:34:40 2013 Or, if you happen to have the timestamps in a file, one per line: perl -lne ‘print scalar localtime $_;’ <timestamps