Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL Workbench: Can't apply NOW() to timestamps field

I get this problem with applying now() to timestamp field. It just doesn't automatically fill in the field with the current time. I tried both now() and NOW() and also current_time, doesn't work either. What can be the problem? What other values I can insert into the field in order to get the current time? enter image description here

enter image description here

like image 466
akburan Avatar asked Feb 02 '17 06:02

akburan


2 Answers

If you want to edit data directly in the Result Grid, for functions add "\func" before that function. In this case try this:

\func now()

it will be now() in the query you will see in Apply SQL Script to Database window.

like image 127
Ali Avatar answered Nov 07 '22 02:11

Ali


Use now() in query without quotes:

Insert into blog.task(body,created_at ,updated_at)values('some values',now(),now());
like image 37
AssenKhan Avatar answered Nov 07 '22 00:11

AssenKhan