Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

History

History
History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..

readme.md

Outline

DateTime

The datetime module supplies classes for manipulating dates and times. for ex: to Import the datetime module and display the current date:

import datetime x = datetime.datetime.now() print(x) When we execute the code from the example above the result will be:

2021-01-14 23:14:32.037299 The date contains year, month, day, hour, minute, second, and microsecond.

method for saving it as a different file once code is executed: The datetime object has a method for formatting date objects into readable strings. The method is called strftime(), and takes one parameter, format, to specify the format of the returned string:

Setup instructions

actually we have used datetime library of python so if its not installed previously please run command pip install DateTime in terminal Now simply run the code and set the output in the newly formed file with the name as current date .

Output

the output file is formed with the name of current date and time and the content of file as per script of code.

Author(s)

vaishnavi jha

Morty Proxy This is a proxified and sanitized view of the page, visit original site.