0% found this document useful (0 votes)
22 views

Date Assignment

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

Date Assignment

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Date assignment

1. Write a program to determine whether a given year is a leap year

2. Write a program to convert unix timestamp string to readable date.

3. Write a program to calculate age of son which is half the age of father who has seen 40 leap
years

4. Write a program to calculate middle of two date range


ex Date1- 20-Sep-2021
Date2- 24-Sep-2021
Middle Date- 22-Sep-2021

5. Write a program to determine the birthdate of person whose age is in seconds is 3400secs
as of today?

6. Write a program to print date of the third Tuesday of a every month of given Year.

7. Write a program to convert given days, hours, minutes, seconds into DateTime.

8. Write a program to print calendar for given year and Month.

Ex

Month (mm): 05

Year (yyyy): 2017

|++++++ 05-2017 +++++|

|Su Mo Tu We Th Fr Sa|

|--------------------|

| 1 2 3 4 5 6|

| 7 8 9 10 11 12 13|

|14 15 16 17 18 19 20|

|21 22 23 24 25 26 27|

|28 29 30 31 |

|--------------------|

9. Write a program to print alternate dates of given Month and Year.

10. Write a program to print dates in fibonacci series pattern from given date and n number.

Ex n=5
date='2021-09-15'

series is 0, 1, 1, 2, 3

dates in fibonacci series pattern= '2021-09-15','2021-09-16','2021-09-16','2021-09-17','2021-


09-18'

11. Write a program to get a list of dates between two dates.

ex Date1- 20-Apr-2019

Date2- 25-Apr-2019

20-Apr-19

21-Apr-19

22-Apr-19

23-Apr-19

24-Apr-19

25-Apr-19

12. Write a program to get the list of dates for the conditions below:
A. Suppose a person is born on 1st january 1992 which was a leap year and the day was
Wednesday.
B. So from 1992 to 2021, how many leap years were there?
C. Since 1992 to 2021, how many of the times it happened that the person’s birthday was on
Wednesday only?
D. Since 1992 to 2021, how many times did it happen that the person’s birthday in a leap
year was on Wednesday only?

You need to take input from user of his birthdate, and then calculate all the above values.
User can enter any date and the program should be able to give the outcome.

13. Write a program to create a world clock.


A. Suppose if user enters today's date time, it will be IST. Then print the same datetime with
different country with different time zones. (US, UK, Chile, South Africa, Russia, Japan,
Australia, etc...)
B. Also consider multiple time Zone of a country, like US has 4 time zone, so if User enters a
date, print that current datetime for IST as well as US’s 4 time zones.
C. Like this consider different global locations around the globe (US, UK, Chile, South Africa,
Russia, Japan, Australia, etc...)

14. Write a program for these conditions-


a. If a user enters his details for datetime of his flight, destination of the flight, suppose if
user is departing from India on 17-09-2021 8:00 pm, then what time his flight will reach
US(in all 4 timezones), considering that on an average a US flight from takes about 25 hours
in total to reach.
Create this program for from both the countries as departure and arrial. (From India to US
and from US to India)

b. Create the above program for multiple countries, considering their timezones. (US, UK,
Chile, South Africa, Russia, Japan, Australia, etc...)

c. Also include the day of departure and arrival.

PLEASE NOTE THAT THE EXAMPLES SHARED WITH THE PROGRAMS ARE ONLY FOR YOUR
UNDERSTANDING, MAKE SURE YOU DO NOT USE THE SAME VALUES TO CREATE YOUR
PROGRAMS AND ALSO MAKE SURE THAT IN THE PROGRAMS WHERE YOU ARE ASKING OF
USER’S INPUT, THE PROGRAM SHOULD WORK FOR EACH AND EVERY INPUT VALUE
PROVIDED BY THE USER.

You might also like