NIELIT O Level Exam

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

Which of the following functions converts date to corresponding time 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 2024 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online MBA 2 years Online MCA Online BCA Best Website and Software Company in Allahabad