Report Bug

Qus

What does the following code do?

from datetime import datetime
dt = datetime.strptime("2024-11-22", "%Y-%m-%d")
print(dt)
Qus

नीचे दिए गए code का output क्या है?

from datetime import datetime
dt = datetime.strptime("2024-11-22", "%Y-%m-%d")
print(dt)


A. Returns the current date
B. Converts the string "2024-11-22" to a datetime object
C. Returns the string "2024-11-22"
D. Raises a ValueError


Solution
B. Converts the string "2024-11-22" to a datetime object



Explanation
strptime() parses a date string according to the specified format and creates a datetime object. <br><br> strptime() दिए गए format के अनुसार string को parse करके datetime object बनाता है।
Latest Current Affairs 2026 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