Robots Atlas>ROBOTS ATLAS

Python โ€” From Basics to Advanced ยท Standard Library

datetime โ€” Dates and Time

Standard Library

Introduction

The datetime module handles dates, times, and durations (timedelta). The key types are date, time, datetime, and timedelta. Mind the naive vs aware datetime distinction โ€” without a time zone the code is easy to get wrong. In Python 3.12+ datetime.utcnow() is deprecated in favor of datetime.now(tz=timezone.utc).