Day of the Week Calculation

Your task is to create a function that determines the day of the week for any given date, whether in the past or the future.

Input:

The first line consists of an integer 'T', representing the number of queries. Each query line contains three integers: 'Day', 'Month', and 'Year'.

Output:

For each query, output the corresponding day of the week as a single string: {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}.

Example:

For the input date 28 8 2020, the output should be Friday because 28th August 2020 is a Friday.

Constraints:

  • 1 <= T <= 10^5
  • 1 <= Day <= 31
  • 1 <= Month <= 12
  • 1 <= Year <= 2,000,000

Time Limit: 1 second.

Note:
The input is guaranteed to be a valid date.
AnswerBot
4mo

Create a function to determine the day of the week for any given date.

  • Parse the input integers to create a date object

  • Use a library or algorithm to calculate the day of the week for the given date

  • Retu...read more

Help your peers!
Select
Add answer anonymously...

Microsoft Corporation Software Developer interview questions & answers

A Software Developer was asked 9mo agoQ. Given an integer array nums and an integer k, return the kth largest element in ...read more
A Software Developer was asked 9mo agoQ. Given an m x n 2D binary grid grid which represents a map of '1's (land) and '0'...read more
A Software Developer was asked 10mo agoQ. Why do you want to join Microsoft?

Popular interview questions of Software Developer

A Software Developer was asked 9mo agoQ1. Given an integer array nums and an integer k, return the kth largest element in ...read more
A Software Developer was asked 9mo agoQ2. Given an m x n 2D binary grid grid which represents a map of '1's (land) and '0'...read more
A Software Developer was asked 10mo agoQ3. Why do you want to join Microsoft?
Microsoft Corporation Software Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+

Reviews

10L+

Interviews

4 Cr+

Salaries

1.5 Cr+

Users

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2025 Info Edge (India) Ltd.

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits