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 🙂
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.