ACF date fields format questions
-
I created a date (i.e. date picker) field (event_date) using ACF. I’m using a query to fetch posts (events) after today’s date e.g. event_date>=date(‘Ymd) seems to work, pls ignore the syntax for brevity sake.
In the ACF plugin when I look at the date format for event_date it’s format is dd/mm/yyyy as confirmed by the output of: echo get_field(‘event_date’); so is this being determined by the Return Format – The format returned via template functions option which I set when creating the ACF field?
If so, why then when I run the query in a WP_Query with
event_date>=date(‘dmY) my query fails to work correctly.
event_date>=date(‘Ymd) my query works correctly.
Again pls ignore the syntax for brevity sake. Are all dates coming from the database via queries in a default format i.e. ‘Ymd’?Can I also ask regarding the following get_field(‘event_date’, false, false), with the second boolean parameter if it’s set to true where is the formatting actually defined?
- The topic ‘ACF date fields format questions’ is closed to new replies.