Newsgroups: comp.lang.c Path: utzoo!telly!druid!darcy From: darcy@druid.uucp (D'Arcy J.M. Cain) Subject: Re: Date to Day-of-Week Conversion (Question) Message-ID: <1991Jun20.164534.28592@druid.uucp> Organization: D'Arcy Cain Consulting, West Hill, Ontario References: <1991Jun19.170753.593@tse.uucp> Distribution: na Date: Thu, 20 Jun 91 16:45:34 GMT In article <1991Jun19.170753.593@tse.uucp> Mark Turner writes: >Hi folks! Can anyone help me with suggestions on how to convert a date to a >day of the week? ... >Please don't suggest that I should reset the system date and then pass a "tm" >structure to the one of the ctime-related functions. I'd like to keep the No need to muck with the system date. Just create a tm structure and fill it in with the known values. now call mktime(3) and you should have the day of the week in the tm_wday field. If you don't have mktime then send me mail and I will send you a version. It's a flawed version but the flaw is well defined and can be worked around. It calls localtime which is not strictly allowed under ANSI. BTW, anyone know where I can get a PD or freeware localtime so I can fix and post my mktime? -- D'Arcy J.M. Cain (darcy@druid) | D'Arcy Cain Consulting | There's no government Toronto, Ontario, Canada | like no government! +1 416 424 2871 |