Support

Account

Home Forums Add-ons Repeater Field Add one year to a date

Helping

Add one year to a date

  • Hi,

    I have a question, i would like to add 1 year to a date create with a repeater field.
    In front office i display, one date called “first-date” like that :
    <?php the_sub_field(‘first-date’); ?> (it’s a field type date-picker)
    Now i want to display another date called “second-date” that display the same date that “first-date” but with adding one year.
    Can somebody can help me?

  • Hi @titia2478,

    There’s a great example in the ACF Date Picker docs under “Advanced” that will help you achieve this!

    The example increases it by a day, so you could adjust accordingly for your needs to increase it by a year and then output that new date in your chosen format.

    (If you want to learn more about the PHP modify function, here are the docs for that as well).

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Add one year to a date’ is closed to new replies.