I have a date field, 'field_date', from which I need to extract the year. The date format is yyyy-mm-dd, so I figured the following would do it:
$date = array_pop(array_pop(field_get_items($entity_type, $entity, 'field_date'))); $year = explode("-", $date); $entity_field['value'] = $year;
This gives me
Parse error: syntax error, unexpected '[' Am I not getting the date string correctly?