Practice Top 30 C Programming Questions on DateTime


Q1. Write a program to print the current date and time in the format YYYY-MM-DD HH:MM:SS.

Q2. Write a program to check if February in a given year has 28 or 29 days.

Q3. Write a program to input a month (1-12) and a year, then print the number of days in that month.

Q4. Write a program to add a specified number of days to the current date and print the new date.

Q5. Write a program to calculate the difference (in days) between two dates.

Q6. Write a program to display the current day of the week.

Q7. Write a program to validate if a given date (YYYY-MM-DD) is valid.

Q8. Write a program to print all leap years between two given years.

Q9. Write a program to find the day of the week for a given date.

Q10. Write a program to convert a given number of seconds into hours, minutes, and seconds.

Q11. Write a program to convert time from 12-hour AM/PM format to 24-hour format.

Q12. Write a program to convert time from 24-hour format to 12-hour AM/PM format.

Q13. Write a program to calculate the number of seconds in a day.

Q14. Write a program to display the system’s current time zone.

Q15. Write a program to calculate the next date from a given date.

Q16. Write a program to find the week number for a given date.

Q17. Write a program to determine the first day of any given year.

Q18. Write a program to calculate the age in years, months, and days given a birthdate.

Q19. Write a program to print the calendar of any given month and year.  

Q20. Write a program to check if a given year is a century year.  

Q21. Write a program to convert a time in HH:MM:SS format to total seconds.  

Q22. Write a program to calculate the difference between two times in HH:MM:SS format.  

Q23. Write a program to create a countdown timer for a given number of seconds.  

Q24. Write a program to determine the number of Fridays in a given year.  

Q25. Write a program to calculate the date N days from today.  

Q26. Write a program to calculate the date N days ago from today.

Q27. Write a program to add N seconds to the current time and display the resulting time.

Q28. Write a program to calculate the day number (out of 365 or 366) for a given date.

Q29. Write a program to calculate the remaining time (hours, minutes, seconds) in the day from the current time.

Q30. Write a program to find the day of the week for any given date.

Social Share

Bikki Singh

Hi, I am the instructor of TechnoVlogs. I have a strong love for programming and enjoy teaching through practical examples. I made this site to help people improve their coding skills by solving real-world problems. With years of experience, my goal is to make learning programming easy and fun for everyone. Let's learn and grow together!

Programming Languages