Prepare variable for your node templates
function THEMENAME_preprocess_node__NODETYPE(&$variables) {
if (isset($variables['content']['FIELDNAME'])) {
$date = $variables['node']->get('FIELDNAME')->first()->getValue()['value'];
$date = new DateTime($date);
$date = $date->getTimestamp();
$variables['VARIABLE'] = $date;
}
}
Example
function scholarly_preprocess_node__mt_event(&$variables) {
if (isset($variables['content']['field_mt_event_date'])) {
$date = $variables['node']->get('field_mt_event_date')->first()->getValue()['value'];
$date = new DateTime($date);
$date = $date->getTimestamp();
$variables['event_date'] = $date;
}
}
Use format_date filter in your node template
{{ VARIABLE | format_date('custom', 'M')}}
Example
{{ event_date | format_date('custom', 'M') }}
Regrading the PHP date formats 'D, d M Y', please check this documentation page http://www.php.net/manual/en/datetime.formats.date.php