Home Forums General Issues Date Picker Less than 30 days Reply To: Date Picker Less than 30 days

  • Hi @garywright

    Please keep in mind that strtotime() returns a timestamp instead of a formatted date. In this case, you need to convert the custom field date to a timestamp. It should be something like this:

    // Get the raw date and convert it to timestamp
    $date_timestanp = strtotime(get_field('acf_date_field_name', false, false));
    if ($date < strtotime('-30 days')) { 
        echo "30 days";
    } else {
        echo "Its OK";

    I hope this helps 🙂