Answers.Body: <p>I think it's unlikely you'll be able to perform this search within any of CiviCRM's existing searches. </p>
  
  <p>Fortunately, it's possible to <a href="https://docs.civicrm.org/dev/en/latest/extensions/civix/#generate-search" rel="nofollow noreferrer">create custom searches</a>. The process requires some coding, but gives you a tremendous amount of power and flexibility.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-07T16:51:41.943Z
Answers.Text: If you need help creating custom searches, you can contact a [CiviCRM expert](https://civicrm.org/partners-contributors) who can do the coding for you, or you can join the [developer chat room](https://chat.civicrm.org/civicrm/channels/dev) and ask questions there.
Answers.UserDisplayName: Sean
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-07T16:50:01.427Z
Answers.LastActivityDate: 2017-09-07T16:50:01.427Z
Answers.UserDisplayName: Sean
Answers.Body: <p>Agreed that there's no way to do date comparisons like this out of the box.  You would have to write a custom search to handle this scenario.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-07T16:49:28.223Z
Answers.LastActivityDate: 2017-09-07T16:49:28.223Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Body: <p>I would like to be able to create a smart group of contacts who:
  1) are participants for an event in the future
  2) have passport expiration dates (a custom Individual Contact date field) that are before the End Date of said event</p>
  
  <p>I'm not finding any way to compare the two date fields. I've looked at CiviRules, but that doesn't seem to get me what I need.</p>
  
  <p>Any suggestions?</p>
  
  <p>(Joomla 3.7.5, Civi 4.7.21)</p>
  
Tags: <search><dates>
Title: Search comparing two date fields
ThreadText: # Search comparing two date fields
  
  (Asked by: username_0 on 2017-09-07)
  
  I would like to be able to create a smart group of contacts who:
  1) are participants for an event in the future
  2) have passport expiration dates (a custom Individual Contact date field) that are before the End Date of said event
  
  I'm not finding any way to compare the two date fields. I've looked at CiviRules, but that doesn't seem to get me what I need.
  
  Any suggestions?
  
  (Joomla 3.7.5, Civi 4.7.21)
  
  **Tags:** search, dates
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2017-09-07. Score: 2 | Accepted answer
  
  I think it's unlikely you'll be able to perform this search within any of CiviCRM's existing searches.
  
  Fortunately, it's possible to [create custom searches](https://docs.civicrm.org/dev/en/latest/extensions/civix/#generate-search). The process requires some coding, but gives you a tremendous amount of power and flexibility.
  
  > **Comments:**
  > **username_1**: If you need help creating custom searches, you can contact a [CiviCRM expert](https://civicrm.org/partners-contributors) who can do the coding for you, or you can join the [developer chat room](https://chat.civicrm.org/civicrm/channels/dev) and ask questions there.  
  
  ---
  
  ### Answer by username_2 on 2017-09-07. Score: 0
  
  Agreed that there's no way to do date comparisons like this out of the box. You would have to write a custom search to handle this scenario.
  
  
  ---
  
  