My content array contains a date field that I’m trying to format as “F Y”.
When I print_r, I’ll get this:
Array
(
[title] => Test
[field_datetime_value_1] => 2012-01-16
[field_datetime_value2] => 2012-01-20
)
If I try:
$test1 = date("F Y", $content['field_datetime_value_1']);
$test2 = date("F Y", strtotime($content['field_datetime_value_1']));
$test3 = $content['field_datetime_value_1'];
print 'Test 1: '.$test1.'<br />Test 2: '.$test2.'<br />Test 3:'.$test3;
I get this:
Test 1:
Test 2: December 1969
Test 3:2012-01-16
I guess I was expecting that in the case of Test 2, I’d get what I was after (namely, January 2012). Can someone help me out here? What am I missing?
It looks like the data in your array is corrupt. Try this: