I am using date custom fields, and I am automatically populating the custom field values to the categories of the post type
I also want to group the posts based on the date custom field.
From date picker I get only date
I want to store the month and year in separate variable so that I can add them to the categories of respective month and year
For example: right now my date picker gives me date 07/07/2013
so I cannot store this date as category as this will be of no use
I want to extract month as July and year as 2013 from the same date picker custom field in some other variable like $month and $year.
Perhaps you could use the update_value filter to run a custom save function.
The update_value filter is run on every value you save with ACF. It’s native functionality is to save the value to the database, however, you can hook in and do what ever you want.
Jump over to the docs and check out the filter. You will be able to look at the value saving, and extract the month / year (with an explode function) and then use the native update_postmeta function to save the value to the post!