Article View: comp.unix.programmer
Article #84Re: Need (today's date + [1-7] days)
From: jpr
Date: Sat, 18 Jul 1992 11:46
Date: Sat, 18 Jul 1992 11:46
43 lines
2098 bytes
2098 bytes
In article <1992Jul16.145836.15586@avalon.nwc.navy.mil> dejesus@archimedes.nwc.navy.mil (Francisco X DeJesus) writes: >I realize that date/time-related questions are common here, so no flames >if this has been asked before... > >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). > >I could sit down and take the brute-force approach and hard-code a bunch >of cases, but I'm looking for something more simple. I've noticed that >you can go "at now + 3 days ..." and you get the date/time back (but >you also get an at job put in the queue...) so I was thinking that there >may be a system call or C function that I don't know about which does >this. So, any suggestions, please email and I'll post a summary if there >is interest. You could change your location. You move 15 degrees about the earth as you add or subtract 1 to or from your TZ. And space and time are equivalent, no? Play with this script: set -v TZ=5 date TZ=-19 date TZ=-43 date TZ=-163 date What it shows me: TZ=5 date Fri Jul 17 20:46:58 1992 TZ=-19 date Sat Jul 18 20:46:58 1992 TZ=-43 date Sun Jul 19 20:46:58 1992 TZ=-163 date Fri Jul 24 20:46:58 1992 -- Jean-Pierre Radley Unix in NYC jpr@jpr.com jpradley!jpr CIS: 72160,1341
Technical Details
Message-ID:
<1992Jul18.014634.9436@jpradley.j>Path:
arc1-ca.pugleaf.net!sparky!uunet!mcsun!fuug!demos!kiae!glas!demos!jpradley.jpr.com!jprReferences:
<1992Jul16.145836.15586@avalon.nw>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!fuug!demos!kiae!glas!demos!jpradley.jpr.com!jpr From: jpr@jpradley.jpr.com Newsgroups: comp.unix.programmer Date: 18 Jul 92 05:46 MDT Subject: Re: Need (today's date + [1-7] days) Sender: Notesfile to Usenet Gateway <notes@glas.apc.org> Message-ID: <1992Jul18.014634.9436@jpradley.j> References: <1992Jul16.145836.15586@avalon.nw> Nf-ID: #R:1992Jul16.145836.15586@avalon.nw:-575817766:1992Jul18.014634.9436@jpradley.j:1193763918:001:1514 Nf-From: jpradley.jpr.com!jpr Jul 18 05:46:00 1992 Lines: 44