How echo a date field in php I am trying to call a custom date field to use in a text pane from a node to use as YYYY-mm-dd in:

&lt;div class="swod-date swod-hide"&gt;yyyy-mm-dd&lt;/div&gt;


I have tried to use:

&lt;?php echo date('Y-m-d', strtotime($node-&gt;field_custom_date['und'][0]['value']));?&gt;


but this is not working.  I have tied to just print the php but get a result of 1970-01-01 instead of the date in the field.  

What am I missing?
Check format_date() function. We can also pass timezone from date field (if any). For example on how to use this function check Formatting the way the date/time is displayed.

$custom_date = strtotime($node-&gt;field_custom_date['und'][0]['value']);
echo format_date($custom_date, 'custom', 'D j M Y');