home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.unix.programmer:3973 comp.unix.questions:9510
- Path: sparky!uunet!haven.umd.edu!mimsy!nmrdc1!frmug!cpio1!bernard
- From: bernard@cpio1.UUCP (Bernard Fouche)
- Newsgroups: comp.unix.programmer,comp.unix.questions
- Subject: Re: Need (today's date + [1-7] days)
- Keywords: date
- Message-ID: <1992Jul27.234643.16885@cpio1.UUCP>
- Date: 27 Jul 92 23:46:43 GMT
- References: <1992Jul16.145836.15586@avalon.nwc.navy.mil> <salem.711339100@pangea.Stanford.EDU>
- Sender: bernard@cpio1.UUCP (Bernard Fouche)
- Organization: CPIO S.A.
- Lines: 35
-
-
- In article <salem.711339100@pangea.Stanford.EDU>, salem@pangea.Stanford.EDU (Bruce Salem) writes:
- > dejesus@archimedes.nwc.navy.mil (Francisco X DeJesus) writes:
- >
- > >If I can get today's date in a shell script or C program, how can I find
- > >out the dates of the next week? For example, if I know today is
- > >"Wed Dec 30 1992", how can I have the program now that the next seven days
- > >are going to be "Thu Dec 31 1992", "Fri Jan 1 1993", etc (taking the
- > >case in which both month and year could change).
- >
- > Look for Gregorian Date to Julian Date conversion routines.
- [ stuff deleted ]
-
- There is also a hack : use TZ and set to a value a negative value if
- you want to go forward in time, a positive value if you want to go
- backward. For instance, assuming your TZ is GMT0, to go forward one
- day, try :
-
- $ date
- Mon Jul 27 23:41:44 WET 1992
- $ TZ=GMT-24 ; export TZ
- $ date
- Mon Jul 28 23:41:54 WET 1992
- $
-
- To go seven days forward, use GMT-(24*7), i.e. : GMT-168
-
- Everybody will probably say that it is something horrible to do but it
- works rather well on many unix systems. (humm I didn't considered Daylight
- Saving Time...)
- --
- -----------------------------------------------------------------------------
- Bernard Fouche VOX : +(33) (1) 48.04.56.30 FAX : (33) (1) 48.04.98.95|
- Email : bernard@cpio1.UUCP or cpio1!bernard@gna.org (try both!)
- Postal Mail : CPIO S.A., 13-15 Rue de la Verrerie, 75004 Paris, France
-