Skip to main content
datetime

datetime

5.5
A module in Python for working with dates and times
  • proper noun
  • Specialized
translation icon : datetime
  • In Python, you can use the datetime module to manipulate date and time objects easily.

Examples

  • To calculate the difference between two dates, you can take advantage of the datetime library in Python.

  • The datetime module provides functions to convert between string and date formats.

  • Although if you do the right thing and store dates in DateTime fields, then that last part is a bit easier.

    Blog text (19)
  • var pubDate = new DateTime(1978, 4, 15);

    Blog text (17)

Surface Forms

datetime main

Morphology

datetime = date + time (transparent) = date + time

The proper name directly references the combined concepts 'date' and 'time' that the module handles.

Etymology

Datetime as the Python module is named after the same idea: it works with both date and time. So when programmers use datetime, they get tools to get, change, and format the date and the time in their code.