pydoc > datetime

πŸ“› NAME

datetime - Fast implementation of the datetime type.

πŸš€ Quick Reference

Use CaseCommandDescription
πŸ“… Create datedate(2025, 4, 15)Construct a date object
πŸ•’ Create datetimedatetime(2025, 4, 15, 13, 30)Construct a datetime object
⏰ Create timetime(13, 30, 0)Construct a time object
⏱️ Durationtimedelta(days=7)Create a timedelta (7 days)
🌍 Fixed offsettimezone(timedelta(hours=2))UTC+2 timezone
πŸ‡ΊπŸ‡Έ Todaydate.today()Current local date
πŸ• Nowdatetime.now()Current local datetime
πŸ•› UTC nowdatetime.utcnow()Current UTC datetime
πŸ“† ISO formatd.isoformat()Date to ISO string (YYYY-MM-DD)
πŸ“ Parse stringdatetime.strptime("2025-04-15", "%Y-%m-%d")Parse datetime from string
πŸ“… Timestampdatetime.fromtimestamp(1712345678.0)Create datetime from POSIX timestamp
πŸ”„ Arithmeticd + timedelta(days=1)Add one day to date

πŸ”— MODULE REFERENCE

https://docs.python.org/3.10/library/datetime.html

The following documentation is automatically generated from the Python source files. It may be incomplete, incorrect or include features that are considered implementation detail and may vary between Python implementations. When in doubt, consult the module reference at the location listed above.

πŸ“¦ CLASSES

builtins.object
date
datetime
time
timedelta
tzinfo
timezone

πŸ•’ class date(builtins.object)

date(year, month, day) --> date object

πŸ”§ Methods defined here

🧰 Class methods defined here

βš™οΈ Static methods defined here

πŸ“‹ Data descriptors defined here

πŸ“Š Data and other attributes defined here

πŸ•‘ class datetime(date)

datetime(year, month, day[, hour[, minute[, second[, microsecond[,tzinfo]]]]])

The year, month and day arguments are required. tzinfo may be None, or an instance of a tzinfo subclass. The remaining arguments may be ints.

Method resolution order: datetime, date, builtins.object

πŸ”§ Methods defined here

🧰 Class methods defined here

βš™οΈ Static methods defined here

πŸ“‹ Data descriptors defined here

πŸ“Š Data and other attributes defined here

πŸ“¦ Methods inherited from date

🧰 Class methods inherited from date

πŸ“‹ Data descriptors inherited from date

πŸ• class time(builtins.object)

time([hour[, minute[, second[, microsecond[, tzinfo]]]]]) --> a time object

All arguments are optional. tzinfo may be None, or an instance of a tzinfo subclass. The remaining arguments may be ints.

πŸ”§ Methods defined here

🧰 Class methods defined here

βš™οΈ Static methods defined here

πŸ“‹ Data descriptors defined here

πŸ“Š Data and other attributes defined here

⏱️ class timedelta(builtins.object)

Difference between two datetime values.

timedelta(days=0, seconds=0, microseconds=0, milliseconds=0, minutes=0, hours=0, weeks=0)

All arguments are optional and default to 0. Arguments may be integers or floats, and may be positive or negative.

πŸ”§ Methods defined here

βš™οΈ Static methods defined here

πŸ“‹ Data descriptors defined here

πŸ“Š Data and other attributes defined here

🌍 class timezone(tzinfo)

Fixed offset from UTC implementation of tzinfo.

Method resolution order: timezone, tzinfo, builtins.object

πŸ”§ Methods defined here

βš™οΈ Static methods defined here

πŸ“Š Data and other attributes defined here

πŸ“¦ Methods inherited from tzinfo

🌐 class tzinfo(builtins.object)

Abstract base class for time zone info objects.

πŸ”§ Methods defined here

βš™οΈ Static methods defined here

πŸ“Š DATA

πŸ“ FILE

/usr/lib/python3.10/datetime.py

datetime
πŸ“› NAME πŸš€ Quick Reference πŸ”— MODULE REFERENCE πŸ“¦ CLASSES
πŸ•’ class date(builtins.object) πŸ•‘ class datetime(date) πŸ• class time(builtins.object) ⏱️ class timedelta(builtins.object) 🌍 class timezone(tzinfo) 🌐 class tzinfo(builtins.object)
πŸ“Š DATA πŸ“ FILE

Generated by phpman v4.9.27 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-07-18 16:08 @216.73.216.114
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 Transitional!Valid CSS!
Enhanced by LLM: deepseek-v4-flash / taotoken.net / www.chedong.com - original format

^_top_^