Home › Forums › ACF PRO › Comparing current date with ACF date › Reply To: Comparing current date with ACF date
In order to compare dates the way your are doing it the date needs to have year first, then month, then day. ACF stores the date in the DB in the format “Ymd”
// supply 3rd argument of false to get unformatted date
$dataScadenza = get_field('data_di_scadenza', false, false);
// use the same date format for the current date
$currentDateTime = date('Ymd');
if($dataScadenza <= $currentDateTime) {
// ......
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.