Support

Account

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.
    }