How do you set a default value for a MySQL Datetime column?
In SQL Server it\'s getdate()
. What is the equivalant for MySQL? I\'m using MySQL 5.x if tha
While you can't do this with DATETIME
in the default definition, you can simply incorporate a select statement in your insert statement like this:
INSERT INTO Yourtable (Field1, YourDateField) VALUES('val1', (select now()))
Note the lack of quotes around the table.
For MySQL 5.5
You can resolve the default timestamp. First consider which character set you are using for example if u taken utf8 this character set support all languages and if u taken laten1 this character set support only for English. Next setp if you are working under any project you should know client time zone and select you are client zone. This step are mandatory.