You can't change the fields value during validation as it's just for validating the supplied value and nothing more. To change a fields value you'd have to process it as part of the storage process either using a custom CB plugin or CB Auto Actions. There's a few triggers this can be done one. They're as follows.
onBeforeprepareFieldDataSave
Code:
$_PLUGINS->trigger( 'onBeforeprepareFieldDataSave', [ &$field, &$user, &$postdata, $reason ] );
That is fired before a field is saved. So it can be used to modify the fields value directly in the $postdata before it ever touches the field. It's a good way to modify the field before server side validation even happens.
onAfterprepareFieldDataSave
Code:
$_PLUGINS->trigger( 'onBeforeprepareFieldDataSave', [ &$field, &$user, &$postdata, $reason ] );
This fires after it has already been bound to the user object so at this point you'd need to modify the value on $user. Either will work and will depend on where in the store process you want to insert custom logic.
If you want client side formatting we do support Input Masks. These let you enforce a format on a field. They're only available for Text fieldtype. You should find the parameters for this under Parameters > Display.