Home › Forums › General Issues › Date Time Picker Check › Reply To: Date Time Picker Check
this is only one possibility
// current unix time stamp
$now = time();
// get field with no formatting
// this will return date time as stored in the db
// to that there isn't any problem with the date format
// when calling strtotime()
$start = strtotime(get_field('start_date_time', false, false));
// same for end
$end = strtotime(get_field('end_date_time', false, false));
if ($start <= $now && $now <= $end) {
// in the middle, do something.
}
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.