Support

Account

Forum Replies Created

  • @phoenix-systems I have kind of the same problem and I think I found the problem, and the solution.

    I realized that updating a DatePicker field, requires you to pass the date with the ‘Ymd’ format (PHP) no matter what format you are using (they really should add it to the documentation).

    my code: (dob = date of birth…)

    
    $dob_str = '23/11/1984';
    $date = DateTime::createFromFormat('d/m/Y', $dob_str);
    $date = $date->format('Ymd');
    
    update_field('date_of_birth', $date, $post_id);
    

    Also worth mentioning is that if you are trying to update a field with the same value (from the database) the function returns false, but that’s WP behaviour if I’m not mistaken.

    Hope it helps you.
    Daniel

Viewing 1 post (of 1 total)