GK SCIENTIST

General Knowledge One Stop Source
Menu
  • Home
  • Social Science
    • History
    • Political Science
    • Geography
  • Science
    • Physics
    • Chemistry
    • Biology
  • Chemistry Notes
  • Mathematics
  • Computer
  • Tutorial MySQL
  • Tutorial Python
  • Java Tutorial
  • English Grammar
  • English Essay
  • Indian Anthropology
  • Philosophy
  • Solved Paper
  • UPSC
  • Current Content
    • Current Affairs
    • RSTV News
    • Yojana and Kurukshetra Gist
  • Donate
  • Contact Us

If you are interested in advertising to our audience, submit the advertising enquiry form.

Advertising Enquiry
Computer

Python Datetime Module

Gk Scientist December 3, 2022 No Comments
Tweet WhatsApp Telegram

Python Datetime Module:

We can use the PyCharm code editor for this example. If you do not know about it then follow this link- How to install PyCharm for Python and create a program in it.

(1) The Python datetime module provides a set of functions and methods for creating, manipulating, and formatting datetime objects.

(2) The datetime() method creates a datetime object and accepts the year, month, day, and optionally hour, minute, second, milliseconds, and time zone arguments.

datetime method in python - Python Datetime Module

(3) The datetime.now() method is used to see the current date and time.

datetime.now method in python - Python Datetime Module

(4) strftime()– The strftime() function allows datetime objects to be converted into custom-formatted strings. This function takes a format string as its input. This format string is made up of special characters beginning with the percent sign as shown below.

FormatterDescriptionExample
%bMonth as locale’s abbreviated name.Jan
%BMonth as locale’s full name.January
%mMonth as a zero-padded decimal number.05
%MMinute as a zero-padded decimal number.45
%yYear without century as a zero-padded decimal number.22
%YYear with century as a decimal number.2022
%HHour (24-hour clock) as a zero-padded decimal number.16
%IHour (12-hour clock) as a zero-padded decimal number.08
%pLocale’s equivalent of either AM or PM.PM
strftime function in python - Python Datetime Module
python strftime function - Python Datetime Module

Tutorial Python
Tutorial MySQL
Natural Language Processing (NLP)
What is Virtual Reality?
Spooling and Virtual Devices
Operating System as a Resource Manager
Linux- Features, and Benefits
Python strftime cheatsheet
Prev Article
Next Article

Related Articles

How to Install Anaconda Python for Machine Learning [Jupyter Notebook]
Install Anaconda Python for Machine Learning: (1) This blog will …
Gk Scientist January 30, 2023 Computer

How to Install Anaconda Python for Machine Learning [Jupyter Notebook]

Python MySQL Self Join and Full Join
Python MySQL Self Join and Full Join: (1) Self Join- …
Gk Scientist December 15, 2022 Computer

Python MySQL Self Join and Full Join

MySQL Sub Query with Exists and Not Exists
MySQL Sub Query: MySQL Sub Query is a query nested …
Gk Scientist November 18, 2022 Computer

MySQL Sub Query with Exists and Not Exists

Python MySQL Insert Query
Python MySQL Insert Query: (1) You have to open the …
Gk Scientist December 12, 2022 Computer

Python MySQL Insert Query

Java FileWriter Class
Java FileWriter Class: We can use the Eclipse IDE for …
Gk Scientist January 13, 2023 Computer

Java FileWriter Class

Python Identity Operators
Python Identity Operators: We can use the PyCharm code editor …
Gk Scientist November 22, 2022 Computer

Python Identity Operators

MySQL UPDATE Statement
MySQL UPDATE Statement: The primary statement used to modify the …
Gk Scientist November 15, 2022 Computer

MySQL UPDATE Statement

Operating System as a Resource Manager
Operating System as a Resource Manager: A computer system consists …
Gk Scientist November 1, 2022 Computer

Operating System as a Resource Manager

Leave a Reply Cancel Reply

Search

  • Popular
  • Recent




GK SCIENTIST

General Knowledge One Stop Source

Information

  • About Us
  • Terms and Condition, Disclaimer
  • Contact Us

Android Apps

  • IAS App For English Medium Students
  • IAS Basics App For English Medium Students
  • IAS Hindi App For Hindi Medium Students
DMCA.com Protection Status

Popular Tags

Biology (33) Biology Questions (88) Chemistry (57) Computer (215) Current Affairs (4) Current Content (0) Economy (17) English Essay (172) English Grammar (75) English Literature (10) Geography (83) History (259) Indian Anthropology (11) Indian Polity (14) JKAS Mains Question Papers (17) Mathematics (68) Moral Science (7) NCERT & Other Boards Books (25) Philosophy (114) Physics (89) Political Science (132) RS TV News (33) Science (553) Social Anthropology (7) Social Science (17) Solved Paper (47) UPSC (7) UPSC Mains Question Papers (26)

Downloads

  • NCERT Books
  • Old NCERT Books
  • NIOS Books For IAS, SSC, and State PSC Exam
  • Tamil Nadu Board Books: Important For UPSC, SSC, and State PSC Exam
  • Modern Indian and World History Notes For IAS Exam
  • UPSC Topper 2013 Gaurav Agrawal Notes For IAS Preparation
  • UPSC IAS Prelims General Studies – Previous Year Papers
  • UPSC Mains Question Papers

Copyright © 2023 GK SCIENTIST
Theme by MyThemeShop.com& Hosted On Cloudways

Ad Blocker Detected

Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by disabling your ad blocker.

Refresh
 

Loading Comments...