Dates and times: Narrowing your search

Searching by date in FHIR is quite powerful. If you want to search for anything matching a date, you can use that date as the search parameter value.

Request: Search query for all patients with a specific birthday

The following example shows a search query for all patients with a given birthday.


Request: Search query for all patients with a specific birthday

Request: Search query for all patients born in a specific year

Partial dates are used to narrow the search, and they will match any values within the part. For example, the following search finds all patients born in 1974.


Request: Search query for all patients born in a specific year

Request: Search query for a date range

Date searches also support a set of qualifiers, which are prefixes on the date that act as a comparator. For example, the value ge2011-01-01 matches any date on or after 2011-01-01. A number of other qualifiers are available under the Date section of the FHIR Search page. The following search query request matches any Encounters for the given patient that started or ended between June 2009 and July 2009.


Request: Search query for a date range

Request: Search query for last updated

FHIR also supports a special parameter called _lastUpdated that can be used on any resource type. This parameter filters search results to only match resources that were last updated at or after the given date/time (or optionally before). The _lastupdate parameter considers the value found in Resource.meta.lastUpdated. It is also important to remember that this value is always provided by the server, and you do not have any control over the resource last updated date. The following search request finds Patient resources updated on or after midnight on Jan 1, 2017.


Request: Search query for last updated