<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to get  previous dates from date command in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-previous-dates-from-date-command/m-p/2884220#M101658</link>
    <description>YESTERDAY=$(TZ=$(date +%Z)+24; date '+%b %e')</description>
    <pubDate>Fri, 17 Jan 2003 07:33:48 GMT</pubDate>
    <dc:creator>RAC_1</dc:creator>
    <dc:date>2003-01-17T07:33:48Z</dc:date>
    <item>
      <title>How to get  previous dates from date command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-previous-dates-from-date-command/m-p/2884219#M101657</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;  How to get  previous dates from date&lt;BR /&gt;  command ? The requirement is to get any&lt;BR /&gt;  previous dates with formats avail in&lt;BR /&gt;  date command. Eg, if I pass parameter 0,&lt;BR /&gt;  then today date, if -1, yesterday, if -2,&lt;BR /&gt;  day before yesterday. If +2, then day after&lt;BR /&gt;  tomorrow date.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;R. Ezhil&lt;BR /&gt;</description>
      <pubDate>Fri, 17 Jan 2003 07:29:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-previous-dates-from-date-command/m-p/2884219#M101657</guid>
      <dc:creator>Ezhilarasan</dc:creator>
      <dc:date>2003-01-17T07:29:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to get  previous dates from date command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-previous-dates-from-date-command/m-p/2884220#M101658</link>
      <description>YESTERDAY=$(TZ=$(date +%Z)+24; date '+%b %e')</description>
      <pubDate>Fri, 17 Jan 2003 07:33:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-previous-dates-from-date-command/m-p/2884220#M101658</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2003-01-17T07:33:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to get  previous dates from date command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-previous-dates-from-date-command/m-p/2884221#M101659</link>
      <description>You may use the GNU date command. It supports things like:&lt;BR /&gt;&lt;BR /&gt;date -d "5 days ago"&lt;BR /&gt;date -d "3 days"&lt;BR /&gt;date -d "3 months 2 days 6 hours ago"&lt;BR /&gt;&lt;BR /&gt;Best regards...&lt;BR /&gt; Dietmar.</description>
      <pubDate>Fri, 17 Jan 2003 08:24:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-previous-dates-from-date-command/m-p/2884221#M101659</guid>
      <dc:creator>Dietmar Konermann</dc:creator>
      <dc:date>2003-01-17T08:24:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to get  previous dates from date command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-previous-dates-from-date-command/m-p/2884222#M101660</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;The use of the following is commonly seen to compute yesterday's date: &lt;BR /&gt;&lt;BR /&gt;# TZ=GMT+24 date +%m/%d/%y &lt;BR /&gt;&lt;BR /&gt;If you are in Europe, living around the Prime Meridian you're in luck. There, you can use +-24 hours as an &lt;OFFSET&gt; to exactly compute yesterday or tommorrow including the correct time. &lt;BR /&gt;&lt;BR /&gt;The man pages for 'environ (5)' note that &lt;OFFSET&gt; is the value that must be added to local time to arrive at UTC (GMT). The offset takes the format hh[:mm[:ss]], where (hh) is any value from 0 through 23. The optional minutes (mm) and seconds (ss) fields are a value from 0 through 59. The hour field is required. If offset is preceded by a -, the time zone is east of the Prime Meridian. A + preceding the offset indicates that the time is west of the Prime Meridian. &lt;BR /&gt;&lt;BR /&gt;Notice, for example, that while it is now 0730 hours on January 17 in the Eastern USA (EST), you cannot produce a date *and time* exactly 24-hours ago. To affect this, the computation would need to offset 29 hours (24+5); an invalid offset. &lt;BR /&gt;&lt;BR /&gt;Clearly there are times during the day when "today" and "yesterday" would yield the same day. Caveat emptor.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF... &lt;BR /&gt;&lt;BR /&gt;&lt;/OFFSET&gt;&lt;/OFFSET&gt;</description>
      <pubDate>Fri, 17 Jan 2003 12:31:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-previous-dates-from-date-command/m-p/2884222#M101660</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2003-01-17T12:31:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to get  previous dates from date command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-previous-dates-from-date-command/m-p/2884223#M101661</link>
      <description>How about this? :&lt;BR /&gt;&lt;BR /&gt;2 days previous in&lt;BR /&gt;16-January-2003 format&lt;BR /&gt;&lt;BR /&gt;DT=$(caljd.sh -e -O -S "-" $(caljd.sh -p 2))&lt;BR /&gt;echo "${DT}"&lt;BR /&gt;&lt;BR /&gt;8 days from now in 01 25 2003 format&lt;BR /&gt;&lt;BR /&gt;DT=$(caljd.sh $(caljd.sh -n 8))&lt;BR /&gt;echo "${DT}"&lt;BR /&gt;&lt;BR /&gt;And this works over a much wider range of dates than the Gnu date command.&lt;BR /&gt;&lt;BR /&gt;Invoke as caljd.sh -u for many options and examples.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 17 Jan 2003 15:40:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-previous-dates-from-date-command/m-p/2884223#M101661</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2003-01-17T15:40:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to get  previous dates from date command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-previous-dates-from-date-command/m-p/2884224#M101662</link>
      <description>And what about this small C proggie? :-) Takes a day count (positive or negative) and gives the date. OK, it does not consider leap years or DST, but nevertheless.&lt;BR /&gt;&lt;BR /&gt;Best regards...&lt;BR /&gt; Dietmar.</description>
      <pubDate>Fri, 17 Jan 2003 17:15:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-previous-dates-from-date-command/m-p/2884224#M101662</guid>
      <dc:creator>Dietmar Konermann</dc:creator>
      <dc:date>2003-01-17T17:15:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to get  previous dates from date command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-previous-dates-from-date-command/m-p/2884225#M101663</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Independently of the Time Zone you actually use, you can use the following sentence to get yesterday's date:&lt;BR /&gt;&lt;BR /&gt;YESTERDAY="$( export TZ=$( date +%Z )+24 ; date )"&lt;BR /&gt;&lt;BR /&gt;date +%Z gives the actual timezone used on the system. +24  makes a shift of 24 hours. setting the TZ environment variable to this, "date" will give you yesterday's date.&lt;BR /&gt;&lt;BR /&gt;You'll just have to compute the shift (in hours) you put in the TZ to get the result you expect:&lt;BR /&gt;&lt;BR /&gt;-( 24 *  0 ) = today,&lt;BR /&gt;-( 24 * -1 ) = yesterday,&lt;BR /&gt;-( 24 * -2 ) = the day before yesterday,&lt;BR /&gt;...&lt;BR /&gt;-( 24 * +1 ) = tomorrow,&lt;BR /&gt;-( 24 * +2 ) = the day after tomorrow,&lt;BR /&gt;and so on...&lt;BR /&gt;&lt;BR /&gt;After, use date command option   to get the result in the format you want.&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;Alex&lt;BR /&gt;</description>
      <pubDate>Sat, 18 Jan 2003 17:35:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-previous-dates-from-date-command/m-p/2884225#M101663</guid>
      <dc:creator>Alexandre Dumont_1</dc:creator>
      <dc:date>2003-01-18T17:35:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to get  previous dates from date command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-previous-dates-from-date-command/m-p/2884226#M101664</link>
      <description>Alexandre Dumont,&lt;BR /&gt;&lt;BR /&gt;    Thanks for your answer for my requirement.&lt;BR /&gt;    I am sorry for late reply.&lt;BR /&gt;    Your one line command seems to be easy.&lt;BR /&gt;    As you said, I tried the following to get&lt;BR /&gt;    date for fews days pervious and later date.&lt;BR /&gt;    It is giving wrong result.&lt;BR /&gt;    Please correct me if wrong.&lt;BR /&gt;&lt;BR /&gt;date&lt;BR /&gt;result--&amp;gt; Mon Feb 3 23:31:46 EST 2003&lt;BR /&gt;&lt;BR /&gt;outdate="$( export TZ=$( date +%Z )+(24*-3); date )" &lt;BR /&gt;&lt;BR /&gt;echo $outdate&lt;BR /&gt;result--&amp;gt; Mon Feb 3 23:31:46 EST 2003&lt;BR /&gt;&lt;BR /&gt;outdate="$( export TZ=$( date +%Z )+72; date )" &lt;BR /&gt;&lt;BR /&gt;echo $outdate&lt;BR /&gt;result--&amp;gt; Mon Feb 3 23:31:46 EST 2003&lt;BR /&gt;     &lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;R. Ezhil&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 04 Feb 2003 04:56:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-previous-dates-from-date-command/m-p/2884226#M101664</guid>
      <dc:creator>Ezhilarasan</dc:creator>
      <dc:date>2003-02-04T04:56:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to get  previous dates from date command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-previous-dates-from-date-command/m-p/2884227#M101665</link>
      <description>I use a C program similar to the one posted here and it's fantastic.&lt;BR /&gt;</description>
      <pubDate>Tue, 04 Feb 2003 04:58:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-previous-dates-from-date-command/m-p/2884227#M101665</guid>
      <dc:creator>Scott Van Kalken</dc:creator>
      <dc:date>2003-02-04T04:58:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to get  previous dates from date command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-previous-dates-from-date-command/m-p/2884228#M101666</link>
      <description>Scott van,&lt;BR /&gt;&lt;BR /&gt;    Thanks for your reply.&lt;BR /&gt;    Can you please attach your C program ?&lt;BR /&gt;    I appreciate your help.&lt;BR /&gt;&lt;BR /&gt;    BTW, is there any good Web site for &lt;BR /&gt;    Unix-C for technical knowledge sharing&lt;BR /&gt;    and forums ?&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;R. Ezhil&lt;BR /&gt;</description>
      <pubDate>Tue, 04 Feb 2003 05:12:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-previous-dates-from-date-command/m-p/2884228#M101666</guid>
      <dc:creator>Ezhilarasan</dc:creator>
      <dc:date>2003-02-04T05:12:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to get  previous dates from date command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-previous-dates-from-date-command/m-p/2884229#M101667</link>
      <description>Here is a shell script we use called "sdate"   Hopefully it will help you :)</description>
      <pubDate>Tue, 04 Feb 2003 14:20:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-previous-dates-from-date-command/m-p/2884229#M101667</guid>
      <dc:creator>Brent W. Moll</dc:creator>
      <dc:date>2003-02-04T14:20:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to get  previous dates from date command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-previous-dates-from-date-command/m-p/2884230#M101668</link>
      <description>Hi all,&lt;BR /&gt;&lt;BR /&gt;I'm also interested in this topic, and I tried to reset TZ to get tomorrow and yesterday, but it seemed that this method doesn't work for offset more than 24 ours, i.e, $TZ-24 gives me tomorrow, and $TZ+24 gives me yesterday, BUT, $TZ+72 gives me today again!  any idea ?</description>
      <pubDate>Tue, 04 Feb 2003 17:10:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-previous-dates-from-date-command/m-p/2884230#M101668</guid>
      <dc:creator>Gary Yu</dc:creator>
      <dc:date>2003-02-04T17:10:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to get  previous dates from date command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-previous-dates-from-date-command/m-p/2884231#M101669</link>
      <description>The TZ trick is not a general solution... it only works under certain conditions.&lt;BR /&gt;&lt;BR /&gt;With your +72 offset the TZ is likely to be ignored completely.  :-)&lt;BR /&gt;&lt;BR /&gt;See environ(5). The offset needs to be in the 0..23 range.&lt;BR /&gt;&lt;BR /&gt;Best regards...&lt;BR /&gt; Dietmar.</description>
      <pubDate>Tue, 04 Feb 2003 17:19:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-previous-dates-from-date-command/m-p/2884231#M101669</guid>
      <dc:creator>Dietmar Konermann</dc:creator>
      <dc:date>2003-02-04T17:19:44Z</dc:date>
    </item>
  </channel>
</rss>

