Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!pcserver2!ddsw1!andyross From: andyross@ddsw1.MCS.COM (Andrew Rossmann) Newsgroups: comp.lang.pascal Subject: Re: Name of day from date & year? Keywords: dayname date year day Message-ID: <1991Feb23.162404.22065@ddsw1.MCS.COM> Date: 23 Feb 91 16:24:04 GMT References: <1991Feb15.121713.10075@newcastle.ac.uk> Organization: ddsw1.MCS.COM Contributor, Wheeling, IL Lines: 19 In article <1991Feb15.121713.10075@newcastle.ac.uk> Boye.Tranum@newcastle.ac.uk (B. Tranum) writes: >I need to find out the name of the day (Monday, Tuesday etc.) from the date >and the year. For example, which day was 10-02-91. - It was a Sunday. > >Does anybody have a nice routine, in Pascal or in English, to do this. I would >be very pleased if you could help me. There are two routines in Turbo Pascal (you didn't say what Pascal or version you wanted.) procedure GetDate(var year, month, day, dayofweek: word); procedure SetDate(year, month, day: word); Both are part of the DOS unit. For dayofweek, 0 = Sunday. If you want to find the dayofweek for any date, save the current date, set it to what you want, read it back to get the dow, and then reset it back. (The only problem might be if you run this right around midnight!!) Programming-wise, this is the easiest. It lets DOS do all the hard work. The only drawback is that it can't go back farther than 1-1-1980.