I use ACF and the Gravity Forms + Custom Post Types plugin so users can create a new event from a front-end Gravity form that becomes an unpublished CPT (Events) when submitted.
I have ACF setting a start and end date for an event via a date picker.
Save Format and Display Format are both set to dd/mm/yy (I can’t use the recommended yymmdd Save Format because this is the only format where the date will be populated from the frontend form).
Every area I can think of is set to dd/mm/yy BUT…
When I use this code to display the Start Date (it’s duplicated for End Date) it acts like the date has been parsed as MM/DD/YY:
<?php $date = get_field(‘start_date’);
$date2 = date(“j F Y”, strtotime($date)); ?>
<?php
if(get_field(‘start_date’))
{
echo ‘<h3>Start date</h3>’ . $date2 . ‘
‘;
}
?>
The date picker of 04/03/16 when checked in ACF is selecting 4 March 2016 as expected, but output from the code above shows it as 3 April 2016.
I’ve spend a long time trying to work out where I might be going wrong here but have not found it. If I set a date like 17/09/16 (September 17) the output is 01/01/1970 so the code is obviously seeing it as 9th of *17th month* and recognising it as a dud date.
Any assistance would be gratefully received.