home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.unix.programmer:3984 comp.unix.questions:9517
- Newsgroups: comp.unix.programmer,comp.unix.questions
- Path: sparky!uunet!munnari.oz.au!metro!bnd2.bnd.oz.au!johnw
- From: johnw@bnd2.bnd.oz.au (John Warburton)
- Subject: Need (today's date - 2 WORKING days) [was: Need (today's date + [1-7]]
- Message-ID: <1992Jul29.031546.26997@bnd2.bnd.oz.au>
- Organization: B&D Doors, Sydney, NSW, Australia
- References: <1992Jul28.072025.13886@cssc-syd.tansu.com.au>
- Date: Wed, 29 Jul 1992 03:15:46 GMT
- Lines: 46
-
- From article <1992Jul28.072025.13886@cssc-syd.tansu.com.au>, by colinl@cssc-syd.tansu.com.au (Colin Lynch):
- > bernie@metapro.DIALix.oz.au (Bernd Felsche) writes:
- >
- >
- > ...The most reliable way to do this is to first convert the current
- > date/time into a time_t type ("time_t" is defined in the system header file
- > <time.h>, and is basically a long containing the number of seconds since the
- > start of 01 Jan 1970 on most systems):
- >
- > #include <time.h>
- >
- > time_t current_time;
- >
- > current_time = time((time_t *)0);
- >
- > Having done this, just set a macro for the length (in seconds) of one
- > day:
- >
- > #define ONE_DAY ((60) * (60) * (24))
- >
- > From here, you can get the value for any day you want. For example, the
- > value for two days' into the future would be:
- >
- > two_days_ahead = current_time + (ONE_DAY * 2);
- >
- > Hope this is helpful. Cheers, Colin.
- >
-
- Ok, that all works, but how do I get the day that was 2 WORKING (Mon..Fri) days
- ago?
-
- I can't seem to find any sort of general purpose way of doing this. Any
- pointers?
-
- John
-
-
-
-
-
-
- --
- John Warburton Internet: johnw@bnd2.bnd.oz.au
- Systems Administrator Phone: +61 2 771 5566
- B & D Australia Fax: +61 2 771 6385
- Living on ice-cream and chocolate kisses...
-