方法

ArcGIS Pro の Arcade を使用した 2 つの日付フィールド間の差の計算

Last Published: July 21, 2023

サマリー

Arcade is an expression language that can be used across the ArcGIS platform. The Arcade Date functions provide methods for creating and acquiring properties of date objects. For example, the DateAdd() and DateDiff() functions can be used to adjust the desired date based on a specified interval, and the Now() function to get the client current local time.

This article provides the steps to use Arcade in ArcGIS Pro to calculate the difference between two date fields using the DateDiff() function.

手順

  1. In ArcGIS Pro, open the attribute table containing the two date fields.
  2. Create a new integer field in the attribute table using the Add Field tool.
  3. In the attribute table, right-click the new field, and click Calculate Field to calculate the difference between the two date fields.
    1. In the Calculate Field pane, select the attribute table containing the date fields for Input Table.
    2. Ensure the new field is selected for Field Name.
    3. For Expression Type, select Arcade.
    4. In the expression text box, type the following expression to calculate the difference in minutes, and replace startDateField and endDateField with the respective field name.
var startDate = Date($feature.startDateField)
var endDate = Date($feature.endDateField)
var result = DateDiff(endDate, startDate, 'minutes')
return result
The image of Calculate Field pane.
Note:
To calculate the difference between the two date fields in other units, such as hours, seconds, or days, use the same expression and replace 'minute' to the desired unit.
  1. Click Run to apply the expression. The difference in minutes between the two date fields is calculated and populated in the new field.
The image of the calculated time difference.

記事 ID: 000023627

AI によるサポートを受ける

Esri サポート AI チャットボットを使用して問題を迅速に解決します。

今すぐチャットを開始

関連情報

このトピックについてさらに調べる

ArcGIS エキスパートのサポートを受ける

テクニカル サポートへのお問い合わせ

今すぐチャットを開始

ダウンロード オプションに移動