home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / unix / programm / 3853 < prev    next >
Encoding:
Internet Message Format  |  1992-07-22  |  2.0 KB

  1. Path: sparky!uunet!mcsun!fuug!demos!kiae!glas!demos!jpradley.jpr.com!jpr
  2. From: jpr@jpradley.jpr.com
  3. Newsgroups: comp.unix.programmer
  4. Date: 18 Jul 92 05:46 MDT
  5. Subject: Re: Need (today's date + [1-7] days)
  6. Sender: Notesfile to Usenet Gateway <notes@glas.apc.org>
  7. Message-ID: <1992Jul18.014634.9436@jpradley.j>
  8. References: <1992Jul16.145836.15586@avalon.nw>
  9. Nf-ID: #R:1992Jul16.145836.15586@avalon.nw:-575817766:1992Jul18.014634.9436@jpradley.j:1193763918:001:1514
  10. Nf-From: jpradley.jpr.com!jpr    Jul 18 05:46:00 1992
  11. Lines: 44
  12.  
  13.  
  14. In article <1992Jul16.145836.15586@avalon.nwc.navy.mil> dejesus@archimedes.nwc.navy.mil (Francisco X DeJesus) writes:
  15. >I realize that date/time-related questions are common here, so no flames
  16. >if this has been asked before...
  17. >
  18. >If I can get today's date in a shell script or C program, how can I find
  19. >out the dates of the next week? For example, if I know today is
  20. >"Wed Dec 30 1992", how can I have the program now that the next seven days
  21. >are going to be "Thu Dec 31 1992", "Fri Jan 1 1993", etc (taking the
  22. >case in which both month and year could change).
  23. >
  24. >I could sit down and take the brute-force approach and hard-code a bunch
  25. >of cases, but I'm looking for something more simple. I've noticed that
  26. >you can go "at now + 3 days ..." and you get the date/time back (but
  27. >you also get an at job put in the queue...) so I was thinking that there
  28. >may be a system call or C function that I don't know about which does
  29. >this. So, any suggestions, please email and I'll post a summary if there
  30. >is interest.
  31.  
  32. You could change your location. You move 15 degrees about the earth as
  33. you add or subtract 1 to or from your TZ. And space and time are equivalent,
  34. no?
  35.  
  36. Play with this script:
  37.  
  38.     set -v
  39.     TZ=5 date
  40.     TZ=-19 date
  41.     TZ=-43 date
  42.     TZ=-163 date
  43.  
  44. What it shows me:
  45.  
  46.     TZ=5 date
  47.     Fri Jul 17 20:46:58  1992
  48.     TZ=-19 date
  49.     Sat Jul 18 20:46:58  1992
  50.     TZ=-43 date
  51.     Sun Jul 19 20:46:58  1992
  52.     TZ=-163 date
  53.     Fri Jul 24 20:46:58  1992
  54. -- 
  55. Jean-Pierre Radley   Unix in NYC   jpr@jpr.com   jpradley!jpr   CIS: 72160,1341
  56.  
  57.