Report Bug
Qus : Which 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.




Report Bug