setFormatter to Current DateTime
setFormatter to Current DateTime

I would like to set a current datetime into the MySQL DB. I don't want to use the update CURRENT_TIME option though on update. I do not have this my_date field in the interface.
I have tried this, but nothing happens in the DB or the interface:
Editor::inst( $db, 'my_tb' ,'my_id')
->fields(
Field::inst( 'my_id' )->set(false),
Field::inst( 'my_date' )->setFormatter( function ( ) { return date('Y-m-d H:i:s'); } ),
What am I missing please?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
This thread should help, it's asking the same thing.
Cheers,
Colin
thanks Colin, this did the trick
Field::inst( 'signin_visitor_signout_date' )->setValue( function ( ) { return date('Y-m-d H:i:s'); } ),