Convert Time Zone (Data Management)

Summary

Converts time values recorded in a date field from one time zone to another time zone.

Converting time values from one time zone to another helps normalize temporal data from different time zones. This improves display and query performance for visualizing temporal data from different time zones using the Time Slider.

Illustration

Convert Time Zone illustration
Converts time values recorded in a date field from one time zone to another time zone.

Usage

  • The input time values to be converted must be stored in a date field.

  • The added output time field will be a date type field.

  • If your data was collected in a time zone that observes Daylight Saving Time, you should choose the parameters to honor Daylight Saving Time in the input and output fields.

Syntax

arcpy.management.ConvertTimeZone(in_table, input_time_field, input_time_zone, output_time_field, output_time_zone, {input_dst}, {output_dst})
ParameterExplanationData Type
in_table

The input feature class or table that contains the time stamps that will be transformed to a different time zone.

Table View
input_time_field

The input field that contains the time stamps that will be transformed to a different time zone.

Field
input_time_zone

The input time zone in which the time stamps were collected.

String
output_time_field

The output field in which the time stamps transformed to the desired output time zone will be stored.

String
output_time_zone

The time zone to which the time stamps will be transformed. By default, the output time zone is the same as the input time zone.

String
input_dst
(Optional)

Indicates whether the time stamps were collected while observing Daylight Saving Time rules in the input time zone. When reading the time values to convert the time zone, the time values will be adjusted to account for the shift in time during Daylight Saving Time.

By default, the input time values are adjusted to account for the shift in time due to the Daylight Saving Time rules in the input time zone.

  • INPUT_ADJUSTED_FOR_DSTThe input time values are adjusted for Daylight Saving Time.
  • INPUT_NOT_ADJUSTED_FOR_DSTThe input time values are not adjusted for Daylight Saving Time.
Boolean
output_dst
(Optional)

Indicates whether the output time values will account for the shift in time due to the Daylight Saving Time rules observed in the output time zone.

By default, the output time values are adjusted to account for the shift in time due to the Daylight Saving Time rules observed in the output time zone.

  • OUTPUT_ADJUSTED_FOR_DSTThe output time values will be adjusted for Daylight Saving Time in the output time zone.
  • OUTPUT_NOT_ADJUSTED_FOR_DSTThe output time values will not be adjusted for Daylight Saving Time in the output time zone.
Boolean

Derived Output

NameExplanationData Type
out_table

The updated input table.

Table View

Code sample

ConvertTimeZone example (Python window)

The following Python window script demonstrates how to use the ConvertTimeZone tool in immediate mode.

import arcpy
arcpy.ConvertTimeZone_management("C:/Data/TemporalData.gdb/InputData","Input_Time","Pacific_Standard_Time","Output_Time","Eastern_Standard_Time","INPUT_ADJUSTED_FOR_DST","OUTPUT_ADJUSTED_FOR_DST")
ConvertTimeZone example 2 (stand-alone script)

The following stand-alone script demonstrates how to use the ConvertTimeZone tool.

# Name: ConvertTimeZone_Ex02.py
# Description: Convert a time field to another time zone
# Requirements: None

# Import system modules
import arcpy

# Set local variables
inTable = "C:/Data/TemporalData.gdb/InputData"
inputTimeField = "Input_Time"
inputTimeZone = "Pacific_Standard_Time"

outputTimeField = "Output_Time"
onputTimeZone = "Eastern_Standard_Time"
inputUseDaylightSaving = "INPUT_ADJUSTED_FOR_DST"
outputUseDaylightSaving = "OUTPUT_ADJUSTED_FOR_DST"

# Execute CalculateEndDate
arcpy.ConvertTimeZone_management(inTable, inputTimeField, inputTimeZone, outputTimeField, onputTimeZone, inputUseDaylightSaving, outputUseDaylightSaving)

Environments

Licensing information

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

Related topics