Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!portal!cup.portal.com!pats From: pats@cup.portal.com (Pat T Shea) Newsgroups: comp.sys.ibm.pc Subject: Re: calendar code Message-ID: <19971@cup.portal.com> Date: 29 Jun 89 00:19:58 GMT References: <82362@ti-csl.csc.ti.com> <25831@agate.BERKELEY.EDU> Organization: The Portal System (TM) Lines: 22 'think this is what ur looking for. . . . /pats. /*********************************************************************** * * int dmy2dow( int iDay, int iMon, int iYear ) - This is my * implementation of the Zeller function. It takes day/ * month/year and returns the day of the week as an int * with Sunday being 0.....etc. * /pats @Psi! * 11/05/85 ******/ int dmy2dow( int day, int mon, int year ) { int adj_mo, adj_yr, cent, cent_yrs; adj_mo = ( mon > 2 ) ? mon - 2 : mon + 10; adj_yr = ( mon > 2 ) ? year : year - 1; cent = adj_yr / 100; cent_yrs = adj_yr % 100; return((((( 13 * adj_mo - 1 ) / 5 ) + day + cent_yrs + ( cent_yrs / 4 ) + ( cent / 4 ) - 2 * cent + 77 ) % 7 )); }