Report Bug

QusWhich of the following functions converts date to corresponding time in Python? Qus निम्नलिखित में से कौन सा फ़ंक्शन पायथन में दिनांक को संगत समय में परिवर्तित करता है?


A. strptime()
B. strftime()
C. Both A and B
D. None of the above


Solution
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.

Online Exam Quiz for One day Exam Online Typing Test CCC Online Test 2026 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 Best Website and Software Company in Allahabad