home *** CD-ROM | disk | FTP | other *** search
- From: tmilner@hprpcd.rose.hp.com (Tom Milner)
- Date: Mon, 31 Aug 1992 19:46:25 GMT
- Subject: Re: Question about date.
- Message-ID: <15360004@hprpcd.rose.hp.com>
- Organization: Performance Technology Center, Roseville
- Path: sparky!uunet!elroy.jpl.nasa.gov!sdd.hp.com!scd.hp.com!hplextra!hpcc05!hpcuhb!hpda!hpergfg2!hprdash!hprpcd!tmilner
- Newsgroups: comp.unix.questions
- References: <1992Aug19.023924.3884@random.ccs.northeastern.edu>
- Lines: 58
-
- In comp.unix.questions, simony@ccs.northeastern.edu (Simon Yeung) writes:
-
-
- | I am writing a C shell script in which the user enter a number n
- | and the script needs to find the date which is the nth day before
- | the current date. Can I do this by using some Unix commands?
- |
- | I don't want to write a program for it, unless I have to.
- |
- | Thanks.
- |
- | --Simon
-
- I believe something VERY similar was posted before...
-
- |>
- |>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
-
- _____________________________________
- /_______________ ___________________/
- / /
- / /
- / / Tom Milner (Tn: 785-5637)
- / / HP Performance Tech Center
- / / tom@hpptc16.rose.hp.com
- /_/ __________________________
-
-