<?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: extract previous date in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/extract-previous-date/m-p/3478988#M704422</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Thanks for all the help. I have used Clay's solution which works absolutely fine.&lt;BR /&gt;&lt;BR /&gt;Clay - Can you please suggest me how to use your script in case I want yesterday's date to be in the format mmddyy (020605).&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Pat &lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Mon, 07 Feb 2005 13:04:31 GMT</pubDate>
    <dc:creator>Pat Peter</dc:creator>
    <dc:date>2005-02-07T13:04:31Z</dc:date>
    <item>
      <title>extract previous date</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/extract-previous-date/m-p/3478981#M704415</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;I need to extract the previous day's date in the form of mmddyyyy in my script.&lt;BR /&gt;&lt;BR /&gt;Can anyone please help me.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Pat&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 04 Feb 2005 15:24:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/extract-previous-date/m-p/3478981#M704415</guid>
      <dc:creator>Pat Peter</dc:creator>
      <dc:date>2005-02-04T15:24:01Z</dc:date>
    </item>
    <item>
      <title>Re: extract previous date</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/extract-previous-date/m-p/3478982#M704416</link>
      <description>Clay Stephenson of these forums has a very nifty utility for this purpose both in shell script and perl formats.&lt;BR /&gt;&lt;BR /&gt;please cruise to this page and scroll down to the bottom. You will see the links to download either version.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.hpux.ws/merijn/" target="_blank"&gt;http://www.hpux.ws/merijn/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Hope this helps&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 04 Feb 2005 15:29:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/extract-previous-date/m-p/3478982#M704416</guid>
      <dc:creator>Mel Burslan</dc:creator>
      <dc:date>2005-02-04T15:29:59Z</dc:date>
    </item>
    <item>
      <title>Re: extract previous date</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/extract-previous-date/m-p/3478983#M704417</link>
      <description>I'm sure that you will see some responses that tell you to alter TZ and then call date but that only works for limited ranges of TZ's and in any event works by accident. This solution , using the attached caljd.sh, script will work anywhere and for any number of days past or future:&lt;BR /&gt;&lt;BR /&gt;YESTERDAY=$(caljd.sh -s $(caljd.sh -p 1))&lt;BR /&gt;echo "Yesterday was ${YESTERDAY}"&lt;BR /&gt;&lt;BR /&gt;Invoke as caljd.sh -u for full usage and examples.&lt;BR /&gt;</description>
      <pubDate>Fri, 04 Feb 2005 15:41:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/extract-previous-date/m-p/3478983#M704417</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2005-02-04T15:41:04Z</dc:date>
    </item>
    <item>
      <title>Re: extract previous date</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/extract-previous-date/m-p/3478984#M704418</link>
      <description>I'll also throw in a Perl solution leveraging the localtime() function and subtracting 1 day (86400 seconds) from current time.&lt;BR /&gt;&lt;BR /&gt;YESTERDAY=$(perl -e '($mday,$mon,$year) = (localtime(time() - 86400)) [3,4,5]; printf("%02d%02d%04d\n",$mon + 1,$mday,$year + 1900)')&lt;BR /&gt;echo "Yesterday was ${YESTERDAY}"&lt;BR /&gt;&lt;BR /&gt;If I got all the ()'s,[]'s, and quotes right that ought to work but I think the caljd.sh solution is much more readable.&lt;BR /&gt;</description>
      <pubDate>Fri, 04 Feb 2005 16:25:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/extract-previous-date/m-p/3478984#M704418</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2005-02-04T16:25:43Z</dc:date>
    </item>
    <item>
      <title>Re: extract previous date</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/extract-previous-date/m-p/3478985#M704419</link>
      <description>I got this off of the web from a while ago. This is meant for gathering the last month, but you can substitute for day as well.  You can gather pretty much what you need from this.&lt;BR /&gt;&lt;BR /&gt;        LAST_MONTH=$((`date +%m` -1))&lt;BR /&gt;        case "$LAST_MONTH"&lt;BR /&gt;        in&lt;BR /&gt;                0)      LM=Dec;;&lt;BR /&gt;                1)      LM=Jan;;&lt;BR /&gt;                2)      LM=Feb;;&lt;BR /&gt;                3)      LM=Mar;;&lt;BR /&gt;                4)      LM=Apr;;&lt;BR /&gt;                5)      LM=May;;&lt;BR /&gt;                6)      LM=Jun;;&lt;BR /&gt;                7)      LM=Jul;;&lt;BR /&gt;                8)      LM=Aug;;&lt;BR /&gt;                9)      LM=Sep;;&lt;BR /&gt;                10)     LM=Oct;;&lt;BR /&gt;                11)     LM=Nov;;&lt;BR /&gt;                12)     LM=Dec;;&lt;BR /&gt;&lt;BR /&gt;        esac&lt;BR /&gt;</description>
      <pubDate>Fri, 04 Feb 2005 17:51:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/extract-previous-date/m-p/3478985#M704419</guid>
      <dc:creator>Sheriff Andy</dc:creator>
      <dc:date>2005-02-04T17:51:51Z</dc:date>
    </item>
    <item>
      <title>Re: extract previous date</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/extract-previous-date/m-p/3478986#M704420</link>
      <description>More than one way to do it, but here's my quick-and-dirty perl:&lt;BR /&gt;&lt;BR /&gt;perl -MPOSIX -e 'print POSIX::strftime("%Y%m%d", localtime(time - 86400));'&lt;BR /&gt;&lt;BR /&gt;Ed&lt;BR /&gt;</description>
      <pubDate>Fri, 04 Feb 2005 18:00:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/extract-previous-date/m-p/3478986#M704420</guid>
      <dc:creator>Ed Loehr</dc:creator>
      <dc:date>2005-02-04T18:00:33Z</dc:date>
    </item>
    <item>
      <title>Re: extract previous date</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/extract-previous-date/m-p/3478987#M704421</link>
      <description>Guess that should be perl -MPOSIX -e 'print POSIX::strftime("%m%d%Y", localtime(time - 86400));'</description>
      <pubDate>Fri, 04 Feb 2005 18:06:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/extract-previous-date/m-p/3478987#M704421</guid>
      <dc:creator>Ed Loehr</dc:creator>
      <dc:date>2005-02-04T18:06:06Z</dc:date>
    </item>
    <item>
      <title>Re: extract previous date</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/extract-previous-date/m-p/3478988#M704422</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Thanks for all the help. I have used Clay's solution which works absolutely fine.&lt;BR /&gt;&lt;BR /&gt;Clay - Can you please suggest me how to use your script in case I want yesterday's date to be in the format mmddyy (020605).&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Pat &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 07 Feb 2005 13:04:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/extract-previous-date/m-p/3478988#M704422</guid>
      <dc:creator>Pat Peter</dc:creator>
      <dc:date>2005-02-07T13:04:31Z</dc:date>
    </item>
    <item>
      <title>Re: extract previous date</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/extract-previous-date/m-p/3478989#M704423</link>
      <description>Here's the Perl method for 2 digit years:&lt;BR /&gt;&lt;BR /&gt;YESTERDAY=$(perl -e '($mday,$mon,$year) = (localtime(time() - 86400)) [3,4,5]; printf("%02d%02d%02d\n",$mon + 1,$mday,$year % 100)')&lt;BR /&gt;echo "Yesterday was ${YESTERDAY}"&lt;BR /&gt;&lt;BR /&gt;... and here's the caljd.sh method:&lt;BR /&gt;&lt;BR /&gt;YESTERDAY=$(caljd.sh -s -C $(caljd.sh -p 1))&lt;BR /&gt;echo "Yesterday was ${YESTERDAY}"&lt;BR /&gt;&lt;BR /&gt;If you had invoked caljd.sh as caljd.sh -u, you would have seen the "-C" option and been able to answer your own question.&lt;BR /&gt;</description>
      <pubDate>Mon, 07 Feb 2005 14:45:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/extract-previous-date/m-p/3478989#M704423</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2005-02-07T14:45:14Z</dc:date>
    </item>
  </channel>
</rss>

