time-machineEasy Examples

Fast datetime mocking (C extension, faster than freezegun)

Getting started with time-machine

Installation and basic usage of time-machine.

python
# Install: pip install time-machine
import time_machine

# Basic time-machine usage
print(f"Using time-machine")
# See documentation for detailed examples
Expected Output
# Expected output shown below
# (Run locally with: time_machine)

time-machine is a third-party package. Fast datetime mocking (C extension, faster than freezegun). Install with: pip install time-machine

Common time-machine operations

Frequently used features of time-machine.

python
# Install: pip install time-machine
import time_machine

# Common time-machine patterns
print(f"time-machine version: {time_machine.__version__}")

These are the most commonly used features of time-machine in everyday development.

Want to try these examples interactively?

Open Easy Playground