Date Question

How could I get a date's day of the week (ie Sunday) without using the date -d command?

So if a date was specified, it would give me the day of the week.

The date -d command looks something like this
date -d $inputdate | cut -c 1-3

the only problem with that statement is that it won't work for dates prior to the 21st century.

Convert the date to a Julian date. The day of the week can be obtained from the remainder of the division of the Julian date by 7. Zero (0) represents Monday.

Would that work for leap years as well?