Search code examples
mysqldatetime

Set current date in the datetime field


There is a datetime field in the MySQL table:

`mytime` datetime

It contains entries like '2012-02-10 10:15'.

How to set the date part to the current date?


Solution

  • You can use -

    update table tblName set mytime = current_date()
    

    Or

    update table tblName set mytime =concat(current_date(),' ',TIME(mytime))