Support

Account

Home Forums ACF PRO Date time picker – strtotime +7 day using ACF number field ?

Solved

Date time picker – strtotime +7 day using ACF number field ?

  • Date time picker
    https://www.advancedcustomfields.com/resources/date-time-picker/

    Query posts (upcoming)

    // find date time in 7 days
    $time_next_week = strtotime('+7 day', $time_now);

    In the example above , is it possible to replace the (‘+7 day’) with an ACF number field that a user can select ?

    Something like –

    $daysafter = get_field('days_after');
    
    // find date time in 7 days
    $time_next_week = strtotime('+$daysafter day', $time_now);

    How could i code this , the above example doesn’t work , so is there a correct way to write this?

  • Sorry , solved it – Like this.

    $daysafter = get_field('days_after');
    
    // find date time in 7 days
    strtotime('+ '.$daysafter. 'days', $time_now);

    Thank you

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

The topic ‘Date time picker – strtotime +7 day using ACF number field ?’ is closed to new replies.