I suppose that field_course_starts_on
and field_course_starts_on
are fields that represent date and you want to print it as date. Correct me if I'm wrong.
So you can print those fields as date like:
print date('d F, Y', $item->field_course_starts_on['und'][0]['safe_value']);
print date('d F, Y', $item->field_course_ends_on['und'][0]['safe_value']);
The part 'd F, Y'
is a date format. Take a look at PHP Documentation to see all options for format parameter.
Update
First you have to load the ids of the field collection fields of the node:
$formtype = field_get_items('node', $node, 'field_latest_schedules');
// Extract the field collection item ids
$ids = array_column($formtype, 'value');
foreach ($formtype as $ft_field) {
$ids[] = $ft_field['value'];
}
To iterate over all fields you can use the following code:
//Get the entities
$collections = field_collection_item_load_multiple($ids);
//Loop over the array - if you have more than one entity
for ($i = 1; $i <= sizeof($collections); $i++) {
$collection = $collections [$i];
//Iterate over all member vars of the FieldCollectionItemEntity object
foreach($collection as $key => $value) {
//Look for fields - there are some other class vars, too.
if (strpos ($key, 'field') !== false) {
//Search for textfields
if (isset($value['und']) && is_array($value ['und']) && isset($value['und'][0]['value'])) {
print "Field ".$key." ".$value['und'][0]['value'];
}
}
}
}
And than debug, target wanted fields and print those fields' values.