8 years ago
Topic

Is there any way to bring in part of a date field into a concat field. Everything I've tried adds the date in the format that is set in that field's input.

For example the date field is formatted to accept "l, j F Y" as the format, in the storage (database) it is set as a datetime format "2015-12-10 00:00:00" but I just want "Y-m-D" (2015-12-10) in the concat field. Any thoughts anyone, I'm out of ideas...?

Get a VIP membership
154 Posts
WebOne
8 years ago
0
Level 1

Hi.

You need to add something like this in a code pack BeforeStore field :

$date = $fields['date']->value;
$createDate = new DateTime($date);
$onlydate = $createDate->format('Y-m-d');
$fields['date']->value = $onlydate;

[you may need to store the new value permanently in the same or another field? eg. date2]


$name = $fields['date']->storage_field;
$table = $fields['date']->storage_table;
$config['storages'][$table][$name] = $fields['date']->value;

Get a Book for SEBLOD