Path: utzoo!attcan!uunet!lll-winken!ames!ucsd!rutgers!bellcore!faline!thumper!gamma!pyuxp!nvuxj!nvuxr!rdm2 From: rdm2@nvuxr.UUCP (R McBurnett) Newsgroups: comp.unix.questions Subject: Re: "yesterdate" function? (and tomorrowdate too) Message-ID: <942@nvuxr.UUCP> Date: 12 Jan 89 18:28:26 GMT References: <19100001@hpficad.HP.COM> <353@bilver.UUCP> Reply-To: rdm2@nvuxr.UUCP (22125-R McBurnett) Organization: Bell Communications Research, Red Bank, NJ Lines: 38 In article <353@bilver.UUCP> bill@bilver.UUCP (bill vermillion) writes: >In article <19100001@hpficad.HP.COM> mcr@hpficad.HP.COM (Matt Reprogle) writes: >> >>I need a way to get yesterday's date in YYMMDD format in a Unix script and put >>it in a file. I don't want to write a C program implementing an entire >>calendar to do it. >> >>Can anyone help? >> >>Matt Reprogle >> >>{everywhere}!hplabs!hpfcla!mcr try this $ date Thu Jan 12 13:21:36 EST 1989 $ TZ=EST29EDT date Wed Jan 11 13:21:42 EST 1989 putting in your normal TZ parameter (5 for east coast) +24 goes back 24 hours. Yes this works for tomorrow too $ TZ=EST-19EDT date Fri Jan 13 13:22:44 EST 1989 you can use the date command to get the YYMMDD also $ date "+%y%m%d" 890112 and in combination with the TZ stuff. -- Roe D McBurnett III Bellcore |these are my own (201)758-2333 rdm2@nvuxr.cc.bellcore.com |rantings not Bellcore's