开发者

Default date in mysql

开发者 https://www.devze.com 2022-12-11 02:53 出处:网络
i am facing issue while creating table where in that one column which is set to default value of current date........i would stress this point \"that i need only date not time along with that\"....i w

i am facing issue while creating table where in that one column which is set to default value of current date........i would stress this point "that i need only date not time along with that"....i would be really thankfull to those who开发者_如何学JAVA tries to help me....


Instead of trying to get MySQL to insert the current date for you when a row is created automatically, you can set it to NOW() in the INSERT query. Or, in the code for your software, you can set the date to the current date in the INSERT query.

MySQL does not support a default of the current date for DATE or DATETIME.


Check out this set yuor field to a 'Date' not 'DateTime'

http://dev.mysql.com/doc/refman/5.1/en/datetime.html

The DATE type is used when you need only a date value, without a time part. MySQL retrieves and displays DATE values in 'YYYY-MM-DD' format. The supported range is '1000-01-01' to '9999-12-31'.

0

精彩评论

暂无评论...
验证码 换一张
取 消