Home › Forums › ACF PRO › Count date picker days › Reply To: Count date picker days
hi bosoxbill,
I solved this with
<?php
$date_from = get_field( 'retreat_date_from' );
$date_to = get_field( 'retreat_date_to' );
$date_1 = new DateTime(date('Y-m-d', strtotime($date_from)));
$date_2 = new DateTime(date('Y-m-d', strtotime($date_to)));
$days = $date_1->diff($date_2)->days;
?>
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.