MCQ Answer

Which of the following functions converts date to corresponding time in Python?

Which of the following functions converts date to corresponding time in Python?

निम्नलिखित में से कौन सा फ़ंक्शन पायथन में दिनांक को संगत समय में परिवर्तित करता है?
Topic : Functions in Python

A. strptime()

B. strftime()

C. Both A and B

D. None of the above




Correct Answer is :

B. strftime()



Explanation

Here's an explanation of both functions for clarity:

strptime(): This function is used to parse (convert) a string representation of a date/time into a datetime object.

strftime(): This function is used to format a datetime object into a string according to a specified format. So, strftime() is the function that converts a datetime object to a string representation of the time, which is what the question asks for.

Latest Current Affairs 2025 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test 2025 Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Sarkari Exam Quiz