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

calendar.timegm

Prev: calendar.TextCalendar | Up: calendar | Next: calendar.weekday
Rel: calendar.calendar, calendar.Calendar, calendar.Day, calendar.firstweekday
Ref: docs.python.org — calendar.timegm
Tags: #public #python3 #stdlib #calendar


Import

import calendar
from calendar import timegm

Signature & Overview

calendar.timegm(tuple)

Unrelated but handy function to calculate Unix timestamp from GMT.

Usage

import calendar
import time

assert calendar.timegm((1970, 1, 1, 0, 0, 0)) == 0
assert calendar.timegm(time.gmtime(1_700_000_000)) == 1_700_000_000

Gotchas

REPL Inspect

from calendar import timegm
help(timegm)

Linked from

Related notes