Python Foundation

+91-7982108418            
                    PYTHON DATE & TIME IMPORTANT QUESTION

 

1. Write a Python script to display the various Date Time formats –
a)Current date and time
b) Current year
c) Month of year
d) Week number of the year
e) Weekday of the week
f) Day of year
g) Day of the month
h) Day of week

2. Write a Python program to determine whether a given year is a leap year.

3. Write a Python program to convert a string to datetime.

4. Write a Python program to get the current time in Python.

5. Write a Python program to subtract five days from current date.

6. Write a Python program to convert unix timestamp string to readable date.

7. Write a Python program to print yesterday, today, tomorrow.

8. Write a Python program to convert the date to datetime (midnight of the date) in
Python.

9. Write a Python program to print next 5 days starting from today.

10. Write a Python program to add 5 seconds with the current time.

11. Write a Python program to convert Year/Month/Day to Day of Year in Python.

12. Write a Python program to get current time in milliseconds in Python

13. Write a Python program to get week number.

14. Write a Python program to find the date of the first Monday of a given week.

15. Write a Python program to select all the Sundays of a specified year.

16. Write a Python program to add year(s) with a given date and display the new
date.

17. Write a Python program to drop microseconds from datetime.

18. Write a Python program to get days between two dates.

19. Write a Python program to get the date of the last Tuesday.

20. Write a Python program to test the third Tuesday of a month.

21. Write a Python program to get the last day of a specified year and month.

22. Write a Python program to get the number of days of a given month and year.

23. Write a Python program to add a month with a specified date.

24. Write a Python program to count the number of Monday of the 1st day of the
month from 2015 to 2016.

25. Write a Python program to print a string five times, delay three seconds.

26. Write a Python program calculates the date six months from the current date
using the datetime module.

27. Write a Python program to create 12 fixed dates from a specified date over a
given period. The difference between two dates will be 20.

28. Write a Python program to get the dates 30 days before and after from the
current date.

29. Write a Python program to get the GMT and local current time.

30. Write a Python program to convert a date to the timestamp.

31. Write a Python program to convert a string date to the timestamp.

32. Write a Python program to calculate a number of days between two dates.

33. Write a Python program to calculate no of days between two datetimes.

34. Write a Python program to display the date and time in a human-friendly string.

35. Write a Python program to convert a date to Unix timestamp.

36. Write a Python program to calculate two date difference in seconds.

37. Write a Python program to convert two date difference in days, hours, minutes,
seconds.

38. Write a Python program to get last modified information of a file.

39. Write a Python program to calculate an age in year.

40. Write a Python program to get the current date time information.

41. Write a python program to generate a date and time as a string

42. Write a Python program to display formatted text output of a month and start
weeks on Sunday.

43. Write a Python program to print a 3-column calendar for an entire year.

44. Write a Python program to display a calendar for a locale

45. Write a Python program to get the current week.

46. Write a Python program to create an HTML calendar with data for a specific
year and month.

47. Write a Python program display a list of the dates for the 2nd Saturday of every
month for a given year.

48. Write a Python program to display a simple, formatted calendar of a given year
and month.

49. Write a Python program to convert a string into datetime

50. Write a Python program to get a list of dates between two dates.

51. Write a Python program to generate RFC 3339 timestamp.

52. Write a Python program to get the first and last second.

Powered by BetterDocs

Contact Us
close slider