Skip to main content

Select Layer By Date And Time (Crime Analysis and Safety Tools)

Summary

Selects records based on date and time ranges or date properties, for example, single date, time range, time period, days of the week, month, or year.

Usage

  • The input must be a feature layer or table view.

  • The input must contain a date field. If the input does not contain a date field, use the Convert Time Field tool to generate a date field derived from dates formatted as text in a text field.

  • This tool performs a selection using all the selection criteria. If any part of the input date does not match the selection criteria, the feature or record will not be selected.

    All date selections are based on the time zone of your computer.

  • To use this tool in a model or script, use the Make Table View or Make Feature Layer tool to convert an input feature class to a table view or feature layer, respectively, before running this tool.

Parameters

Label Explanation Data type

Input Rows

The data containing a date field to which the selection will be applied.

Table View; Feature Layer

Selection Type

Specifies how the selection will be applied and what will occur if a selection already exists.

  • New selection—The resulting selection will replace the current selection. This is the default.

  • Add to the current selection—The resulting selection will be added to the current selection if one exists. If no selection exists, this is the same as the new selection option.

  • Remove from the current selection—The resulting selection will be removed from the current selection. If no selection exists, this option has no effect.

  • Select subset from the current selection—The resulting selection will be combined with the current selection. Only records that are common to both remain selected.

String

Time Type

Specifies how date and time fields will be used to select records.

  • Single Time Field—Records will be selected based on a single time field on the input feature.

  • Time Range Fields—Records will be selected based on start and end time fields on the input feature.

String

Date Field

(Optional)

The date field from the input layer on which the selection will be based. This parameter is only active if the Time Type parameter is set to Single Time Field.

Field

Start Date Field

(Optional)

The start date field from the time range on which the selection will be based. This parameter is only active if the Time Type parameter is set to Time Range Fields .

Field

End Date Field

(Optional)

The end date field from the time range on which the selection will be based. This parameter is only active if the Time Type parameter is set to Time Range Fields.

Field

Selection Options

(Optional)

Specifies how date and time selections will be made.

  • Date—The selection will be by date.

  • Time—The selection will be by time of day.

  • Day of week—The selection will be by day of the week.

  • Month—The selection will be by month.

  • Year—The selection will be by year.

String

Date Selection Type

(Optional)

Specifies whether records will be selected based on a date range, single date, recency period, or comparative time period.

This parameter is only active when the Selection Options parameter is set to Date.

  • By Date Range—Records will be selected based on a start and end date range.

  • By Single Date—Records will be selected based on the a single specified date.

  • By Recency—Records will be selected based on a time period in relation to the current date (system date and time), for example, within the last 14 days.

  • By Comparative Time Period—Records will be selected based on the time period immediately preceding a recent time period in relation to the current date (system date and time). For example, if the current date is January 29 and the time slice is 14 days, records occurring between January 1 and January 14 will be selected. This option can be used in combination with a subsequent By Recency selection to compare record counts between two adjacent time periods (for example, the two 14-day time periods of January 1-14 and January 15-28).

String

Date

(Optional)

The single date and time to be selected.

This parameter is only active when the Date Selection Type parameter is set to By Single Date.

Date

Start Date

(Optional)

The start date of the date range.

This parameter is only active when the Date Selection Type parameter is set to By Date Range.

Date

End Date

(Optional)

The end date of the date range.

This parameter is only active when the Date Selection Type parameter is set to By Date Range.

Date

Use Current System time as End Time

(Optional)

Specifies whether records from the current day (local system time) will be included in the selection if they exist in the recent time period.

For example, the time slice specified is 14 days, the local system time is 5:00 p.m. on January 15 when the tool runs, the recency time period includes all records between 5:00 p.m. on the date 14 days ago and 5:00 p.m. on the day the tool runs, and the parameter is checked. In this example, the selection will be January 1, 2017 5:00:00 PM to January 15, 2017 5:00:00 PM. Using this same example when the parameter is unchecked, the recent period uses the beginning of the current day as the end time (based on local system time). In this case, the selection will be January 1, 2017 12:00:00 AM to January 15, 12:00:00 AM for the 14-day time slice.

This parameter is only active when the Date Selection Type parameter is set to By Comparative Time Period or By Regency.

  • Checked—Records from the current day will be included in the selection.

  • Unchecked—Records from the current day will not be included in the selection. This is the default.

Boolean

Time Slice

(Optional)

The number of time units (minutes, hours, days, weeks, months, or years) defining the recent time period on which the selection will be based, for example, events within the last 14 days.

This parameter is only active when the Date Selection Type parameter is set to By Comparative Time Period or By Recency.

Time Unit

Start Time

(Optional)

The start time of the time range.

This parameter is only active when the Selection Options parameter is set to Time.

Date

End Time

(Optional)

The end time of the time range.

This parameter is only active when the Selection Options parameter is set to Time.

Date

Days of Week

(Optional)

Specifies the day or days of the week that will be used to select records.

This parameter is only active when the Selection Options parameter is set to Day of week.

  • Monday—Records occurring on Monday will be selected.

  • Tuesday—Records occurring on Tuesday will be selected.

  • Wednesday—Records occurring on Wednesday will be selected.

  • Thursday—Records occurring on Thursday will be selected.

  • Friday—Records occurring on Friday will be selected.

  • Saturday—Records occurring on Saturday will be selected.

  • Sunday—Records occurring on Sunday will be selected.

String

Months

(Optional)

Specifies the month or months that will be used to select records.

This parameter is only active when the Selection Options parameter is set to Month.

  • January—Records occurring in January will be selected.

  • February—Records occurring in February will be selected.

  • March—Records occurring in March will be selected.

  • April—Records occurring in April will be selected.

  • May—Records occurring in May will be selected.

  • June—Records occurring in June will be selected.

  • July—Records occurring in July will be selected.

  • August—Records occurring in August will be selected.

  • September—Records occurring in September will be selected.

  • October—Records occurring in October will be selected.

  • November—Records occurring in November will be selected.

  • December—Records occurring in December will be selected.

String

Years

(Optional)

The year or years that will be used to select records.

This parameter is only active when the Selection Options parameter is set to Years.

Long

Derived output

Label Explanation Data type

Updated Layer or Table View

The updated inputs with selections applied.

Table View; Feature Layer

Row Count

The number of selected records.

Long

Environments

This tool does not use any geoprocessing environments.

Licensing information

  • Basic: Yes
  • Standard: Yes
  • Advanced: Yes