On this page
  1. time.struct_time
  2. Import
  3. Signature & Overview
  4. Methods & Attributes
  5. Usage
  6. Gotchas
  7. REPL Inspect

time.struct_time

Prev: time.strptime | Up: time | Next: time.thread_time
Rel: time.asctime, time.clock_getres, time.clock_gettime, time.clock_gettime_ns
Ref: docs.python.org โ€” time.struct_time
Tags: #public #python3 #stdlib #time


Import

import time
from time import struct_time

Signature & Overview

time.struct_time(iterable=(), /)

The time value as returned by gmtime(), localtime(), and strptime(), and accepted by asctime(), mktime() and strftime(). May be considered as a sequence of 9 integers.

Methods & Attributes

Usage

import time

tm = time.struct_time((2026, 12, 2, 17, 30, 0, 2, 336, 0))
assert tm.tm_year == 2026 and tm.tm_mon == 12

Gotchas

REPL Inspect

from time import struct_time
help(struct_time)

Linked from

Related notes