callbackBeforeUpdate not working with date

The following code will only write 00/00/0000 00:00:00 back to the datetime field in the database. calling date works in callbackEditForm so why not callbackBeforeUpdate???

	$crud->callbackBeforeUpdate(function ($stateParameters) {
		
		
		$test = date('d/m/Y H:i:s');
		
	    $stateParameters->data['record_cmr_checked_date'] = $test;

		return $stateParameters;
	});

Hello @markab ,

When you are adding the value into the database you should use the form: Y-m-d H:i:s

So try this instead:

$test = date('Y-m-d H:i:s');
1 Like

Yes that fixed it thanks.