Xref: utzoo comp.databases:6742 comp.software-eng:4036 Path: utzoo!attcan!uunet!cs.utexas.edu!sun-barr!newstop!sun!jasonf From: jasonf@cetemp.Eng.Sun.COM (Jason Freund) Newsgroups: comp.databases,comp.software-eng Subject: Calendar Algorithm Keywords: calendar algorithm Message-ID: <140352@sun.Eng.Sun.COM> Date: 8 Aug 90 16:12:23 GMT Sender: news@sun.Eng.Sun.COM Lines: 24 I need to be able to change dates in a database cell with commands like "+4w" == "Find the closest weekday to the day 4 weeks from a certain date", "-12d" == "Find the closest weekday 12 days earlier than this date.", and so on. I'll be writing in Pascal -- the code is no problem -- I'll give my function a "+/-", a number, and a "d/w/m" (day, week, month), and a date "MMDDYY". The function returns the closes weekday by adding/subtracting according to its parameters. Does anyone know of a general algorithm for dealing with calendars? It must that take into account leap years and be able to find what day of the week it is (MTWRF) so that it can make approximations to weekdays. I've seen some good ones before, (for computing how many days old you are and what day of the week you were born on) but I can't find any now. BTW, when is the next leap year? Thanks, Jason Freund, Sun Microsystems, jasonf@cetemp.Corp.sun.com <== summer address Deprtmnt of Computer Science, Univ California, Davis. freund@sakura.ucdavis.edu Quantum Link: JasonF5, Compu$erve: 72007,244, 690 Erie Dr, Sunnyvale, CA 94087 ------------------------------------------------------------------------------- STOLEN QUOTES -- Please give the authors credit if you know who they are! "To understand recursion, you need to understand recursion." "Wow! Virtual memory! Now I'm gonna build me a REALLY big ram disk!" "My other computer is a SUN3/50." "E. Pluribus UNIX" -- authors unkown