ArcGIS for Desktop

  • ドキュメント
  • 価格
  • サポート

  • My Profile
  • ヘルプ
  • Sign Out
ArcGIS for Desktop

ArcGIS Online

組織のマッピング プラットフォーム

ArcGIS for Desktop

完全なプロ仕様の GIS

ArcGIS for Server

エンタープライズ GIS

ArcGIS for Developers

位置情報利用アプリの開発ツール

ArcGIS Solutions

各種業界向けの無料のテンプレート マップおよびテンプレート アプリケーション

ArcGIS Marketplace

組織で使えるアプリとデータを取得

  • ドキュメント
  • 価格
  • サポート
Esri
  • サイン イン
user
  • マイ プロフィール
  • サイン アウト

Help

  • ホーム
  • 開始
  • マップ
  • 解析
  • データ管理
  • ツール
  • その他...

TimeZoneInfo

  • サマリ
  • 説明
  • 構文
  • メソッドの概要
  • メソッド
  • コードのサンプル

サマリ

The TimeZoneInfo class can be used to read or assign a time zone to a Python datetime object.

説明

Native datetime objects are not time zone aware. By assigning a time zone to a datetime object, time zone-related operations can be performed. For example, you can use the time zone associated with a time value and convert it to another time zone.

構文

TimeZoneInfo
 (time_zone_id)
パラメータ説明データ タイプ
time_zone_id

A valid time zone ID. A list of available time zone IDs can be obtained from the ListTimeZones function.

String

メソッドの概要

メソッド説明
tzname (dt)

Returns the time zone name corresponding to the Python datetime object, dt, as a string.

メソッド

tzname (dt)
パラメータ説明データ タイプ
dt

A reference to a Python datetime object.

(デフォルト値は次のとおりです None)

DateTime

戻り値

データ タイプ説明
String

The time zone name corresponding to the datetime object, dt.

Returns the time zone name corresponding to the datetime object, dt, as a string.

コードのサンプル

TimeZoneInfo example 1

The following script applies a 'Pacific Standard Time' time zone to a Python datetime object. It then loops through each month to demonstrate how the time zone name will change to 'Pacific Daylight Time' during the summer in observance of Daylight Savings Time.

import arcpy
import datetime

tzinfo = arcpy.time.TimeZoneInfo('Pacific Standard Time')

time = datetime.datetime(2011, 1, 1, tzinfo=tzinfo)

for delta in range(1, 13):
    next_date = time + arcpy.time.EsriTimeDelta(1 * delta, "months")
    print next_date, tzinfo.tzname(next_date)
TimeZoneInfo example 2

The following script demonstrates how to convert a datetime value in Pacific Standard Time to Eastern Standard Time.

import arcpy
import datetime

from_tzinfo = arcpy.time.TimeZoneInfo('Pacific Standard Time')
target_tzInfo = arcpy.time.TimeZoneInfo('Eastern Standard Time')
from_time = datetime.datetime.now(from_tzinfo)
print "target_time =", str(from_time.astimezone(target_tzInfo))
このトピックへのフィードバック

ArcGIS for Desktop

  • ホーム
  • ドキュメント
  • 価格
  • サポート

ArcGIS プラットフォーム

  • ArcGIS Online
  • ArcGIS for Desktop
  • ArcGIS for Server
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

Esri について

  • 会社概要
  • 採用情報
  • スタッフ ブログ
  • ユーザ カンファレンス
  • デベロッパ サミット
Esri
© Copyright 2016 Environmental Systems Research Institute, Inc. | プライバシー | リーガル