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

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