Write a python program to print date, time for today and now

In this source code example, we will write a python program to print the date, and time for today and now.

Write a python program to print the date, time for today, and now

import datetime
a=datetime.datetime.today()
b=datetime.datetime.now()
print(a)
print(b)

Output:

2022-06-27 09:40:11.994858
2022-06-27 09:40:11.994868

Comments