On this page
  1. time.strftime
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

time.strftime

Prev: time.sleep | Up: time | Next: time.strptime
Rel: time.asctime, time.clock_getres, time.clock_gettime, time.clock_gettime_ns
Ref: docs.python.org — time.strftime
Tags: #public #python3 #stdlib #time


Import

import time
from time import strftime

Signature & Overview

time.strftime(format[, tuple]) -> string

Convert a time tuple to a string according to a format specification.

Usage

import time

s = time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(0))
assert s == "1970-01-01 00:00:00"

Gotchas

REPL Inspect

from time import strftime
help(strftime)

Linked from

Related notes