Python Datetime Programs with Solutions
20 Python datetime programs with solutions: format and parse dates, add days, age, weekday, month end, business days, time zones, each explained.
Online Learning Platform
Free tutorials, solved practice problems and interview prep for QA and automation engineers: Python, Playwright, Selenium, SQL, Git and more.
20 Python datetime programs with solutions: format and parse dates, add days, age, weekday, month end, business days, time zones, each explained.
Write a Python program to print the calendar of a month. Step-by-step explanation, colour-coded code and real output.
Write a Python program that prints the days, hours and minutes until an event. Step-by-step explanation, colour-coded code and real output.
Write a Python program to find the date of the next Monday after a given date. Step-by-step explanation, colour-coded code and real output.
Write a Python program to get the day of the year and ISO week number of a date. Step-by-step explanation, colour-coded code and real output.
Write a Python program to sort a list of date strings in date order. Step-by-step explanation, colour-coded code and real output.
Write a Python program to convert 12:00 UTC to Indian Standard Time. Step-by-step explanation, colour-coded code and real output.
Write a Python program to convert between a datetime and a Unix timestamp. Step-by-step explanation, colour-coded code and real output.
Write a Python program to list every date in a week. Step-by-step explanation, colour-coded code and real output.
Write a Python program to find hours and minutes between two datetimes. Step-by-step explanation, colour-coded code and real output.
Write a Python program to count the working days (Monday to Friday) between two dates. Step-by-step explanation, colour-coded code and real output.
Write a Python program to add months to a date, clamping to the month's last day. Step-by-step explanation, colour-coded code and real output.
Take free timed mock tests with answers and explanations.