<?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: Working with date using shell scripts in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/working-with-date-using-shell-scripts/m-p/4988926#M780795</link>
    <description>First to address your suggestion for an improvement. The "standard" UNIX command behavior is to output and error message when INCORRECT arguments are used NOT when no arguments are supplied -- as long as that is a legal condition for a given command. Do ls, cat, bc, or date output a usage message when supplied with no arguments? Caljd.sh's behavior changes with the number of arguments left after all options have been stripped: if 0, output today's Julian Day; if 1) convert a Julian Day into a Gregorian date; if 3) convert a Gregorian Date into a Julian Day. The very behavior you are complaining about is what makes the command so flexible and reversible. It's also fairly standard across most flavors of UNIX to use command -? or command -u or command -h to output help on stderr. -h is already a meaningful argument (it says skip past holidays) but either -u or -? will generate a usage message. Your request for an "improvement" is rejected but since it is a script feel free to "fix" it as much as you like.&lt;BR /&gt;&lt;BR /&gt;Now there was a subtle bug when combining outputting month names with a non-whitespace separator but this is fixed in the version, 2.27, attached here.&lt;BR /&gt;&lt;BR /&gt;To get 10 days from today in DD-MMM-YYYY format the solution is:&lt;BR /&gt;&lt;BR /&gt;TODAYPLUS10=$(caljd.sh -e -S "-" -o $(caljd.sh -n 10))&lt;BR /&gt;echo "10 days from now is ${TODAYPLUS10}"&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Thu, 06 Jul 2006 11:35:31 GMT</pubDate>
    <dc:creator>A. Clay Stephenson</dc:creator>
    <dc:date>2006-07-06T11:35:31Z</dc:date>
    <item>
      <title>Working with date using shell scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/working-with-date-using-shell-scripts/m-p/4988914#M780783</link>
      <description>Hi there,&lt;BR /&gt;&lt;BR /&gt;This is about date calculations. The question is, &lt;BR /&gt;&lt;BR /&gt;Suppose today is 25 Feb 2004. How do I correctly find out the date after 10 days? (Consider month change, leap year etc.)&lt;BR /&gt;&lt;BR /&gt;Is there any function which I could use straigt away?&lt;BR /&gt;&lt;BR /&gt;I do give points to responses.&lt;BR /&gt;&lt;BR /&gt;Thanks in advance!&lt;BR /&gt;Anoop</description>
      <pubDate>Wed, 05 Jul 2006 05:03:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/working-with-date-using-shell-scripts/m-p/4988914#M780783</guid>
      <dc:creator>Anoop P_2</dc:creator>
      <dc:date>2006-07-05T05:03:46Z</dc:date>
    </item>
    <item>
      <title>Re: Working with date using shell scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/working-with-date-using-shell-scripts/m-p/4988915#M780784</link>
      <description>One of forum members AC Clay has written one script called date hammer. Search forums for it. It serves many such purposes.</description>
      <pubDate>Wed, 05 Jul 2006 05:12:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/working-with-date-using-shell-scripts/m-p/4988915#M780784</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2006-07-05T05:12:31Z</dc:date>
    </item>
    <item>
      <title>Re: Working with date using shell scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/working-with-date-using-shell-scripts/m-p/4988916#M780785</link>
      <description>Anoop,&lt;BR /&gt;get a copy of the excellent caljd package by A. Clay Stephenson.&lt;BR /&gt;&lt;BR /&gt;One version at:&lt;BR /&gt;&lt;A href="http://mirrors.develooper.com/hpux/" target="_blank"&gt;http://mirrors.develooper.com/hpux/&lt;/A&gt;&lt;BR /&gt;right at the bottom of the page.</description>
      <pubDate>Wed, 05 Jul 2006 05:13:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/working-with-date-using-shell-scripts/m-p/4988916#M780785</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2006-07-05T05:13:33Z</dc:date>
    </item>
    <item>
      <title>Re: Working with date using shell scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/working-with-date-using-shell-scripts/m-p/4988917#M780786</link>
      <description>Hi Anoop, &lt;BR /&gt;&lt;BR /&gt;You can use A.Clay's script (Caljd) &lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://mirrors.develooper.com/hpux/caljd-2.25.sh" target="_blank"&gt;http://mirrors.develooper.com/hpux/caljd-2.25.sh&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://mirrors.develooper.com/hpux/caljd-2.2.pl" target="_blank"&gt;http://mirrors.develooper.com/hpux/caljd-2.2.pl&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;-Arun</description>
      <pubDate>Wed, 05 Jul 2006 05:14:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/working-with-date-using-shell-scripts/m-p/4988917#M780786</guid>
      <dc:creator>Arunvijai_4</dc:creator>
      <dc:date>2006-07-05T05:14:54Z</dc:date>
    </item>
    <item>
      <title>Re: Working with date using shell scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/working-with-date-using-shell-scripts/m-p/4988918#M780787</link>
      <description>And once you find this mysterious script then to find the date 10 days from now in MM/DD/YYYY format you would:&lt;BR /&gt;&lt;BR /&gt;TODAYPLUS10=$(caljd.sh -S "/" $(caljd.sh -n 10))&lt;BR /&gt;echo "10 days from now is ${TODAYPLUS10}"&lt;BR /&gt;&lt;BR /&gt;And, yes, it works across year boundaries, leap years. It can also calculate n days from a given date in either direction and can even optionally skip days in the week so that "10 days from now unless that is a weekend" also works. In that case, the next non-excluded day is output.&lt;BR /&gt;&lt;BR /&gt;Invoke as caljd.sh -u for usage and many examples.</description>
      <pubDate>Wed, 05 Jul 2006 09:20:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/working-with-date-using-shell-scripts/m-p/4988918#M780787</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2006-07-05T09:20:45Z</dc:date>
    </item>
    <item>
      <title>Re: Working with date using shell scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/working-with-date-using-shell-scripts/m-p/4988919#M780788</link>
      <description>Hey;&lt;BR /&gt;&lt;BR /&gt;No disrespect to A.Clay's script, but you could also download gnu date and use it thusly:&lt;BR /&gt;&lt;BR /&gt;$ date --date="10 days"         &lt;BR /&gt;Sat Jul 15 09:24:42 CDT 2006&lt;BR /&gt;$ date&lt;BR /&gt;Wed Jul  5 09:24:43 CDT 2006&lt;BR /&gt;$ date --date="3 days ago"&lt;BR /&gt;Sun Jul  2 09:29:02 CDT 2006&lt;BR /&gt;&lt;BR /&gt;Other, more standard formatting strings can be used as well...&lt;BR /&gt;&lt;BR /&gt;gnu date, and other gnu utilies can be found at:  &lt;A href="http://hpux.cs.utah.edu/hppd/hpux/Gnu/sh_utils-2.0/" target="_blank"&gt;http://hpux.cs.utah.edu/hppd/hpux/Gnu/sh_utils-2.0/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;HTH;&lt;BR /&gt;&lt;BR /&gt;Doug</description>
      <pubDate>Wed, 05 Jul 2006 09:29:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/working-with-date-using-shell-scripts/m-p/4988919#M780788</guid>
      <dc:creator>Doug O'Leary</dc:creator>
      <dc:date>2006-07-05T09:29:55Z</dc:date>
    </item>
    <item>
      <title>Re: Working with date using shell scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/working-with-date-using-shell-scripts/m-p/4988920#M780789</link>
      <description>Clay,&lt;BR /&gt;i remember that, in a particular year(around 1800 i think), they suddenly changed to a new year format.. so some 10 days missed in that particular month..&lt;BR /&gt;is ur script considers that also..?</description>
      <pubDate>Wed, 05 Jul 2006 12:42:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/working-with-date-using-shell-scripts/m-p/4988920#M780789</guid>
      <dc:creator>inventsekar_1</dc:creator>
      <dc:date>2006-07-05T12:42:41Z</dc:date>
    </item>
    <item>
      <title>Re: Working with date using shell scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/working-with-date-using-shell-scripts/m-p/4988921#M780790</link>
      <description>The year was 1752 (at least for some countries and their colonies). Do a "cal 9 1752". and no, caljd.sh, does not take that into account. It calculates proleptic dates -- meaning it always calculates dates in Gregorian even for dates before the Gregorian calendar was adopted. Note that the calendar wasn't even universally adopted for many years so the proleptic model makes as much sense as any other.&lt;BR /&gt;&lt;BR /&gt;One of the contributory reasons for Napoleon's victory at Austerlitz in 1805 was that the Russians were still using the Julian calendar while the Austrians and English were using the Gregorian calendar so that when the allies agreed to converge their forces they agreed on a date that was nevertheless a different day.&lt;BR /&gt;&lt;BR /&gt;The "short" September in 1752 also caused riots (particularly in Ireland) when the landlords showed up to collect the rent. The landlords were justly saying the a new month was here and the tenets were justly saying that they were cheated out of two weeks --- and both were right and wrong.</description>
      <pubDate>Wed, 05 Jul 2006 14:17:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/working-with-date-using-shell-scripts/m-p/4988921#M780790</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2006-07-05T14:17:53Z</dc:date>
    </item>
    <item>
      <title>Re: Working with date using shell scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/working-with-date-using-shell-scripts/m-p/4988922#M780791</link>
      <description>Hi.&lt;BR /&gt;&lt;BR /&gt;Thanks for all who responded. A.Clay's solution helped me through, but I had problems to get the date in the format "DD-MMM-YY" Any ways, I wrote some lines on my own to accomplish that.&lt;BR /&gt;&lt;BR /&gt;Clay, The script is good, but I have one suggestion to standardize it like many other HPUX commands. The script returns the Julian day if executed with out any option, but I expected it to return the usage. To  know how to use it, I had to give lots of wrong arguments :) until today when I saw that it had the -u option. Thats just a suggestion.&lt;BR /&gt;&lt;BR /&gt;Great script; hats off to you.&lt;BR /&gt;&lt;BR /&gt;Have assigned points as usual.&lt;BR /&gt;&lt;BR /&gt;Cheers!&lt;BR /&gt;Anoop</description>
      <pubDate>Wed, 05 Jul 2006 23:47:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/working-with-date-using-shell-scripts/m-p/4988922#M780791</guid>
      <dc:creator>Anoop P_2</dc:creator>
      <dc:date>2006-07-05T23:47:31Z</dc:date>
    </item>
    <item>
      <title>Re: Working with date using shell scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/working-with-date-using-shell-scripts/m-p/4988923#M780792</link>
      <description>Shalom Anoop,&lt;BR /&gt;&lt;BR /&gt;I've ported A. Clay's script to Linux (1 line fix, change the shell). I had to do a fair amount of testing on it because its a production script on all my Linux/HP-UX server.&lt;BR /&gt;&lt;BR /&gt;I think there is a way to use it to exactly get your date format. Otherwise maybe he'll upgrade it.&lt;BR /&gt;&lt;BR /&gt;What do you mean by standardize like other HP-UX commands? Its not part of the OS, its an add in. Maybe A. Clay should sell it to HP as part of the OS?&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Thu, 06 Jul 2006 00:40:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/working-with-date-using-shell-scripts/m-p/4988923#M780792</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2006-07-06T00:40:31Z</dc:date>
    </item>
    <item>
      <title>Re: Working with date using shell scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/working-with-date-using-shell-scripts/m-p/4988924#M780793</link>
      <description>Hi SEP,&lt;BR /&gt;&lt;BR /&gt;I will reframe it this way. "Standardize like other Unix commands"&lt;BR /&gt;&lt;BR /&gt;Unix commands which need an argument to function normally, output the usage syntax, when ever no argument is passed with the command. A usual behavour. &lt;BR /&gt;&lt;BR /&gt;I was suggesting to have this feature here too. I dont insist.&lt;BR /&gt;&lt;BR /&gt;Thanks!&lt;BR /&gt;Anoop</description>
      <pubDate>Thu, 06 Jul 2006 00:55:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/working-with-date-using-shell-scripts/m-p/4988924#M780793</guid>
      <dc:creator>Anoop P_2</dc:creator>
      <dc:date>2006-07-06T00:55:03Z</dc:date>
    </item>
    <item>
      <title>Re: Working with date using shell scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/working-with-date-using-shell-scripts/m-p/4988925#M780794</link>
      <description>I'm using the mktime SW and it's great!&lt;BR /&gt;&lt;A href="http://fresh.t-systems-sfr.com/unix/src/privat2/mktime-2.3.tar.gz/" target="_blank"&gt;http://fresh.t-systems-sfr.com/unix/src/privat2/mktime-2.3.tar.gz/&lt;/A&gt; &lt;BR /&gt;&lt;BR /&gt;To obtain your date:&lt;BR /&gt;mktime -F %y%m%d -d+10&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Art</description>
      <pubDate>Thu, 06 Jul 2006 03:45:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/working-with-date-using-shell-scripts/m-p/4988925#M780794</guid>
      <dc:creator>Arturo Galbiati</dc:creator>
      <dc:date>2006-07-06T03:45:05Z</dc:date>
    </item>
    <item>
      <title>Re: Working with date using shell scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/working-with-date-using-shell-scripts/m-p/4988926#M780795</link>
      <description>First to address your suggestion for an improvement. The "standard" UNIX command behavior is to output and error message when INCORRECT arguments are used NOT when no arguments are supplied -- as long as that is a legal condition for a given command. Do ls, cat, bc, or date output a usage message when supplied with no arguments? Caljd.sh's behavior changes with the number of arguments left after all options have been stripped: if 0, output today's Julian Day; if 1) convert a Julian Day into a Gregorian date; if 3) convert a Gregorian Date into a Julian Day. The very behavior you are complaining about is what makes the command so flexible and reversible. It's also fairly standard across most flavors of UNIX to use command -? or command -u or command -h to output help on stderr. -h is already a meaningful argument (it says skip past holidays) but either -u or -? will generate a usage message. Your request for an "improvement" is rejected but since it is a script feel free to "fix" it as much as you like.&lt;BR /&gt;&lt;BR /&gt;Now there was a subtle bug when combining outputting month names with a non-whitespace separator but this is fixed in the version, 2.27, attached here.&lt;BR /&gt;&lt;BR /&gt;To get 10 days from today in DD-MMM-YYYY format the solution is:&lt;BR /&gt;&lt;BR /&gt;TODAYPLUS10=$(caljd.sh -e -S "-" -o $(caljd.sh -n 10))&lt;BR /&gt;echo "10 days from now is ${TODAYPLUS10}"&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 06 Jul 2006 11:35:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/working-with-date-using-shell-scripts/m-p/4988926#M780795</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2006-07-06T11:35:31Z</dc:date>
    </item>
    <item>
      <title>Re: Working with date using shell scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/working-with-date-using-shell-scripts/m-p/4988927#M780796</link>
      <description>Clay,&lt;BR /&gt;&lt;BR /&gt;I think you are right. Thank you for the script and the explanation.&lt;BR /&gt;&lt;BR /&gt;Anoop</description>
      <pubDate>Fri, 07 Jul 2006 00:50:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/working-with-date-using-shell-scripts/m-p/4988927#M780796</guid>
      <dc:creator>Anoop P_2</dc:creator>
      <dc:date>2006-07-07T00:50:35Z</dc:date>
    </item>
  </channel>
</rss>

