Wednesday, July 17, 2019

Current date and time

Script

#!/usr/local/bin/python3.7

import datetime

capture = datetime.datetime.now()

print("")

print ("Current date and time = %s" % capture)

print ("Today's date:  = %s/%s/%s" % (capture.day, capture.month, capture.year))

print ("The time now is: = %s:%s:%s" % (capture.hour, capture.minute, capture.second))

print("")


Execution

Current date and time = 2021-09-12 23:27:24.959818

Today's date:  = 12/9/2021

The time now is: = 23:27:24

















No comments:

Post a Comment