Sql zeller code for finding day

Sql zeller code for finding day

Zeller’s congruence is an algorithm that can be used to determine the day of the week for any given date.Write a single T-SQL batch that implements this algorithm to calculate the day of the week for a specifieddate. Abide by the following minimum requirements: Read up on Zeller’s congruence on Wikipedia(http://en.wikipedia.org/wiki/Zeller%27s_congruence) Declare at least 2 variables – the one named @input of type datetime, and the other @output oftype varchar(10) Assign any valid datetime value (from the year 1800 onwards) to the @input variable Implement the algorithm for the Gregorian calendar (which we use in South Africa) using T-SQLstatements, operators and structures Convert the integer answer given by the algorithm to the corresponding day name (e.g. Sunday,Monday, Tuesday etc) using a CASE statement Display the value in the @output variable You may only use the DATEPART system function to extract the year, month and date from aspecified datetime input With the exception of the above, you may NOT use any other datetime system functions You are not allowed to use any hardcoded data or lookup any data from tables, with the exceptionof the CASE statement to translate the day number into a text description.