DateTime_Math
DateTime_Math
Datetime:
Python has a module named datetime to work with dates and times.
It provides a variety of classes for representing and manipulating dates and
times, as well as formatting and parsing dates and times in a variety of formats.
print(now)
Output
2023-03-08 09:31:26.137671
print(current_date)
Output
2023-03-08
We can get year, month, day, day of the week etc. from the date object easily.
For example,
from datetime import date
Output
Math Module:
Python has a built-in math module.
It is a standard module, so we don't need to install it separately.
We only have to import it into the program we want to use.
We can import the module, like any other module of Python, using import math
to implement the functions to perform mathematical operations.
This module does not support complex datatypes.
import math
math.sqrt(4)
Here is the list of some of the functions and attributes defined in math module
with a brief explanation of what they do.
Function Description