You could save a line here and other places by doing:

```php
$attributes['value'] = date_create($attributes['value'])->format('d');
```