<?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: Date computation in a shell script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/date-computation-in-a-shell-script/m-p/2586352#M856572</link>
    <description>Bala,&lt;BR /&gt;&lt;BR /&gt;Unfortunately there is no single command to do arthmetic on dates. There are quite a number ways to do this. As perl is almost there on unix systems, you can use the method suggested by David in the thread &lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/cm/QuestionAnswer/1,1150,0x2fc2854994d9d4118fef0090279cd0f9,00.html" target="_blank"&gt;http://forums.itrc.hp.com/cm/QuestionAnswer/1,1150,0x2fc2854994d9d4118fef0090279cd0f9,00.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;or you can use the logic behind it.&lt;BR /&gt;&lt;BR /&gt;-Sri&lt;BR /&gt;</description>
    <pubDate>Thu, 27 Sep 2001 21:45:23 GMT</pubDate>
    <dc:creator>Sridhar Bhaskarla</dc:creator>
    <dc:date>2001-09-27T21:45:23Z</dc:date>
    <item>
      <title>Date computation in a shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/date-computation-in-a-shell-script/m-p/2586348#M856568</link>
      <description>Hi All&lt;BR /&gt;&lt;BR /&gt;Is there a way to add/subtract days using date function in a shell script ? &lt;BR /&gt;Please don't tell me that I have to write lengthy unix script .&lt;BR /&gt;&lt;BR /&gt;for e.g I want to add 2 days to the current date in a shell script !!!&lt;BR /&gt;i.e expr "`date + 2`" or something like that&lt;BR /&gt;&lt;BR /&gt;Thanks in advance&lt;BR /&gt;&lt;BR /&gt;Bala&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 27 Sep 2001 21:28:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/date-computation-in-a-shell-script/m-p/2586348#M856568</guid>
      <dc:creator>Bala_4</dc:creator>
      <dc:date>2001-09-27T21:28:20Z</dc:date>
    </item>
    <item>
      <title>Re: Date computation in a shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/date-computation-in-a-shell-script/m-p/2586349#M856569</link>
      <description>This has been asked before here is one link i found that should help you out.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/cm/QuestionAnswer/1,1150,0x5fc3854994d9d4118fef0090279cd0f9,00.html" target="_blank"&gt;http://forums.itrc.hp.com/cm/QuestionAnswer/1,1150,0x5fc3854994d9d4118fef0090279cd0f9,00.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 27 Sep 2001 21:36:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/date-computation-in-a-shell-script/m-p/2586349#M856569</guid>
      <dc:creator>someone_4</dc:creator>
      <dc:date>2001-09-27T21:36:44Z</dc:date>
    </item>
    <item>
      <title>Re: Date computation in a shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/date-computation-in-a-shell-script/m-p/2586350#M856570</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;I have a simple utility that makes this duck soup. The script is complicated but it's already written - so who cares.&lt;BR /&gt;&lt;BR /&gt;The idea is that we convert today's date to a true Jukian Day (~ num of days since 4004 BCE) and add 2 to it and then send that number back in to the script. &lt;BR /&gt;&lt;BR /&gt;TODAY=`caljd.sh`&lt;BR /&gt;NEXTDATE=$((${TODAY} + 2))&lt;BR /&gt;NEWDATE=`caljd.sh ${NEXTDATE}`&lt;BR /&gt;echo ${NEWDATE}.&lt;BR /&gt;&lt;BR /&gt;The attached script does all the hard work and if you execute caljd.sh -u it will display the full usage. The neat thing about this method is that it will work across months, leap years,&lt;BR /&gt;past or future, ...&lt;BR /&gt;&lt;BR /&gt;Regards, Clay</description>
      <pubDate>Thu, 27 Sep 2001 21:39:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/date-computation-in-a-shell-script/m-p/2586350#M856570</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2001-09-27T21:39:10Z</dc:date>
    </item>
    <item>
      <title>Re: Date computation in a shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/date-computation-in-a-shell-script/m-p/2586351#M856571</link>
      <description>No long UNIX script just a simple line of perl&lt;BR /&gt;&lt;BR /&gt; perl -e 'print scalar localtime (time +2 * 86400),"\n"'&lt;BR /&gt;&lt;BR /&gt;will add 2 days to the current date&lt;BR /&gt;&lt;BR /&gt; perl -e 'print scalar localtime (time -2 * 86400),"\n"'&lt;BR /&gt;&lt;BR /&gt;will subtract 2 days from the current date&lt;BR /&gt;&lt;BR /&gt;Hope this helps</description>
      <pubDate>Thu, 27 Sep 2001 21:41:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/date-computation-in-a-shell-script/m-p/2586351#M856571</guid>
      <dc:creator>Jeffrey S. Sims</dc:creator>
      <dc:date>2001-09-27T21:41:50Z</dc:date>
    </item>
    <item>
      <title>Re: Date computation in a shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/date-computation-in-a-shell-script/m-p/2586352#M856572</link>
      <description>Bala,&lt;BR /&gt;&lt;BR /&gt;Unfortunately there is no single command to do arthmetic on dates. There are quite a number ways to do this. As perl is almost there on unix systems, you can use the method suggested by David in the thread &lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/cm/QuestionAnswer/1,1150,0x2fc2854994d9d4118fef0090279cd0f9,00.html" target="_blank"&gt;http://forums.itrc.hp.com/cm/QuestionAnswer/1,1150,0x2fc2854994d9d4118fef0090279cd0f9,00.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;or you can use the logic behind it.&lt;BR /&gt;&lt;BR /&gt;-Sri&lt;BR /&gt;</description>
      <pubDate>Thu, 27 Sep 2001 21:45:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/date-computation-in-a-shell-script/m-p/2586352#M856572</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2001-09-27T21:45:23Z</dc:date>
    </item>
    <item>
      <title>Re: Date computation in a shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/date-computation-in-a-shell-script/m-p/2586353#M856573</link>
      <description>Thanks Everyone for the quick replies...&lt;BR /&gt;&lt;BR /&gt;Thanks again&lt;BR /&gt;&lt;BR /&gt;Bala&lt;BR /&gt;</description>
      <pubDate>Thu, 27 Sep 2001 21:53:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/date-computation-in-a-shell-script/m-p/2586353#M856573</guid>
      <dc:creator>Bala_4</dc:creator>
      <dc:date>2001-09-27T21:53:13Z</dc:date>
    </item>
  </channel>
</rss>

