Date Time オフィシャルより抜粋

import datetime

dir(datetime)

In [ ]:

[s for s in dir(datetime) if s.islower() and not s.startswith('_')]

Out[ ]:

['date', 'datetime', 'sys', 'time', 'timedelta', 'timezone', 'tzinfo']

dir(datetime.method)

dir(datetime.date)

class datetime.date(year, month, day) date オブジェクトは、両方向に無期限に拡張された現在のグレゴリオ暦という理想化された暦の日付 (年月日) を表します。In [ ]:

[s for s in dir(datetime.date) if s.islower() and not s.startswith('_')]

Out[ ]:

['ctime',
 'day',
 'fromisocalendar',
 'fromisoformat',
 'fromordinal',
 'fromtimestamp',
 'isocalendar',
 'isoformat',
 'isoweekday',
 'max',
 'min',
 'month',
 'replace',
 'resolution',
 'strftime',
 'timetuple',
 'today',
 'toordinal',
 'weekday',
 'year']

date.weekday() 月曜日を 0、日曜日を 6 として、曜日を整数で返します。例えば、 date(2002, 12, 4).weekday() == 2 であり、水曜日を示します。 isoweekday() も参照してください。

date.isoweekday() 月曜日を 1,日曜日を 7 として、曜日を整数で返します。例えば、 date(2002, 12, 4).isoweekday() == 3 であり、水曜日を示します。 weekday(), isocalendar() も参照してください。

dir(datetime.time)

In [ ]:

[s for s in dir(datetime.time) if s.islower() and not s.startswith('_')]

Out[ ]:

['dst',
 'fold',
 'fromisoformat',
 'hour',
 'isoformat',
 'max',
 'microsecond',
 'min',
 'minute',
 'replace',
 'resolution',
 'second',
 'strftime',
 'tzinfo',
 'tzname',
 'utcoffset']

dir(datetime.datetime)

class datetime.datetime(year, month, day, hour=0, minute=0, second=0, microsecond=0, tzinfo=None, *, fold=0) datetime オブジェクトは date オブジェクトおよび time オブジェクトの全ての情報が入っている単一のオブジェクトです。

datetime.weekday()¶ 月曜日を 0、日曜日を 6 として、曜日を整数で返します。 self.date().weekday() と同じです。 isoweekday() も参照してください。

datetime.isoweekday() 月曜日を 1、日曜日を 7 として、曜日を整数で返します。 self.date().isoweekday() と等価です。 weekday() 、 isocalendar() も参照してください。In [ ]:

[s for s in dir(datetime.datetime) if s.islower() and not s.startswith('_')]

Out[ ]:

['astimezone',
 'combine',
 'ctime',
 'date',
 'day',
 'dst',
 'fold',
 'fromisocalendar',
 'fromisoformat',
 'fromordinal',
 'fromtimestamp',
 'hour',
 'isocalendar',
 'isoformat',
 'isoweekday',
 'max',
 'microsecond',
 'min',
 'minute',
 'month',
 'now',
 'replace',
 'resolution',
 'second',
 'strftime',
 'strptime',
 'time',
 'timestamp',
 'timetuple',
 'timetz',
 'today',
 'toordinal',
 'tzinfo',
 'tzname',
 'utcfromtimestamp',
 'utcnow',
 'utcoffset',
 'utctimetuple',
 'weekday',
 'year']

dir(datetime.timedelta)

class datetime.timedelta(days=0, seconds=0, microseconds=0, milliseconds=0, minutes=0, hours=0, weeks=0)

timedelta オブジェクトは経過時間、すなわち二つの日付や時刻間の差を表します。 days, seconds, microseconds だけが内部的に保持されます 1 ミリ秒は 1000 マイクロ秒に変換されます。引数は以下のようにして変換されます 1 分は 60 秒に変換されます。 1 時間は 3600 秒に変換されます。 1 週間は 7 日に変換されます。In [ ]:

[s for s in dir(datetime.timedelta) if s.islower() and not s.startswith('_')]

Out[ ]:

['days',
 'max',
 'microseconds',
 'min',
 'resolution',
 'seconds',
 'total_seconds']

dir(datetime.timezone)

In [ ]:

[s for s in dir(datetime.timezone) if s.islower() and not s.startswith('_')]

Out[ ]:

['dst', 'fromutc', 'max', 'min', 'tzname', 'utc', 'utcoffset']

dir(datetime.tzinfo)

In [ ]:

[s for s in dir(datetime.tzinfo) if s.islower() and not s.startswith('_')]

Out[ ]:

['dst', 'fromutc', 'tzname', 'utcoffset']

dir(datetime.)sys

In [ ]:

[s for s in dir(datetime.sys) if s.islower() and not s.startswith('_')]

Out[ ]:

['addaudithook',
 'api_version',
 'argv',
 'audit',
 'base_exec_prefix',
 'base_prefix',
 'breakpointhook',
 'builtin_module_names',
 'byteorder',
 'call_tracing',
 'callstats',
 'copyright',
 'displayhook',
 'dllhandle',
 'dont_write_bytecode',
 'exc_info',
 'excepthook',
 'exec_prefix',
 'executable',
 'exit',
 'flags',
 'float_info',
 'float_repr_style',
 'get_asyncgen_hooks',
 'get_coroutine_origin_tracking_depth',
 'getallocatedblocks',
 'getcheckinterval',
 'getdefaultencoding',
 'getfilesystemencodeerrors',
 'getfilesystemencoding',
 'getprofile',
 'getrecursionlimit',
 'getrefcount',
 'getsizeof',
 'getswitchinterval',
 'gettrace',
 'getwindowsversion',
 'hash_info',
 'hexversion',
 'implementation',
 'int_info',
 'intern',
 'is_finalizing',
 'last_traceback',
 'last_type',
 'last_value',
 'maxsize',
 'maxunicode',
 'meta_path',
 'modules',
 'path',
 'path_hooks',
 'path_importer_cache',
 'platform',
 'prefix',
 'ps1',
 'ps2',
 'ps3',
 'pycache_prefix',
 'set_asyncgen_hooks',
 'set_coroutine_origin_tracking_depth',
 'setcheckinterval',
 'setprofile',
 'setrecursionlimit',
 'setswitchinterval',
 'settrace',
 'stderr',
 'stdin',
 'stdout',
 'thread_info',
 'unraisablehook',
 'version',
 'version_info',
 'warnoptions',
 'winver']

参考サイトLiibercraft|リーベルクラフト

Liibercraft|リーベルクラフト

コメント

タイトルとURLをコピーしました