# Tag Archives: date-time-program

## Program to calculate age

Given current date and birth date, find the present age. Examples: Input : Birth date = 07/09/1996 Present date = 07/12/2017 Output : Present Age… Read More »

## Find time when hour and minute hands superimpose

This puzzle is an extension of the famous interview problem, find angle between hour and minute hand at any given time. The questions asks us… Read More »

## difftime() C library function

The C library function difftime() returns the difference, in seconds between starting time and ending time.(ending time-starting time) // It is present in time.h header… Read More »

## Difference between two given times

Given two times in string “HH:MM” format. Here ‘H’ shows hours and ‘M’ shows minutes. You have to find the difference in same string format… Read More »

## C++ Program to print current Day, Date and Time

In order to facilitate finding the current local day, date and time, C++ has defined several functions in the header file , so functions which… Read More »

## Zeller’s Congruence | Find the Day for a Date

Zeller’s congruence is an algorithm devised by Christian Zeller to calculate the day of the week for any Julian or Gregorian calendar date. It can… Read More »

## Changing One Clock Time to Other Time in Minimum Number of Operations

Given two clock times (in HH:MM:SS format), change one time to other time in minimum number of operations. Here one operation is meant by shifting… Read More »

## Find a time for which angle between hour and minute hands is given theta

Given angle theta, find a possible time (in hh:mm format) when angle between hour hand and clock hand is theta. If no such time exists… Read More »

## Date after adding given number of days to the given date

Given a date and a positive integer x. The task is to find date after adding n days to the given date Examples: Input :… Read More »

## C++ program to convert time from 12 hour to 24 hour format

Given a time in 12-hour AM/PM format, convert it to military (24-hour) time. Note: Midnight is 12:00:00 AM on a 12-hour clock and 00:00:00 on… Read More »

## Program to check if a date is valid or not

Given a date, check if it is valid or not. It may be assumed that the given date is in range from 01/01/1800 to 31/12/9999.… Read More »

## Find the next identical calendar year

You are given an year Y, find the next identical calendar year to Y. Examples: Input : 2017 Output : 2023 Input : 2018 Output… Read More »

## Calendar Functions in Python | Set 2(monthrange(), prcal(), weekday()…)

Some of calendar functions are discussed in the Set 1 1. monthrange(year, month) :- This function returns two integers, first, the starting day number… Read More »

## Calendar Functions in Python | Set 1( calendar(), month(), isleap()…)

Python defines an inbuilt module “calendar” which handles operations related to calendar. Operations on calendar : 1. calendar(year, w, l, c) :- This function displays… Read More »