<?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: Fiscal Date Shell Script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/fiscal-date-shell-script/m-p/3884220#M280403</link>
    <description>Hi Monte,&lt;BR /&gt;&lt;BR /&gt;based on Mr. Hassel's suggestion: &lt;BR /&gt;&lt;BR /&gt;$ eval typeset -Z2 X=$(($(date +%y ) + 1)); date +%Y-${X}&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;John K.</description>
    <pubDate>Sat, 21 Oct 2006 12:44:16 GMT</pubDate>
    <dc:creator>john korterman</dc:creator>
    <dc:date>2006-10-21T12:44:16Z</dc:date>
    <item>
      <title>Fiscal Date Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/fiscal-date-shell-script/m-p/3884215#M280398</link>
      <description>Trying to get the fiscal date from the Unix date command, but need the fiscal date in the format :  2006-07.&lt;BR /&gt;&lt;BR /&gt;Have the following script:&lt;BR /&gt;echo "This is a date test"&lt;BR /&gt;yearlong=$(date +%Y)&lt;BR /&gt;yearshort=$(date +%y)&lt;BR /&gt;echo "Year short --&amp;gt; " $yearshort&lt;BR /&gt;yearshort=$(($yearshort+1))&lt;BR /&gt;#if [ $yearshort -lt 10 ]&lt;BR /&gt;#then&lt;BR /&gt;#    echo "less than 10 " $yearshort&lt;BR /&gt;#   yearshort =$(string "0"+$yearshort)&lt;BR /&gt;#    exit&lt;BR /&gt;#fi&lt;BR /&gt;echo "The fiscal date is $yearlong-$yearshort"&lt;BR /&gt;~&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The fiscal date ends up as 2006-7.&lt;BR /&gt;How can I get the extra zero in the fiscal date?  Trying to get the fiscal year to feed a&lt;BR /&gt;dbaccess query thru a script.&lt;BR /&gt;Monte.</description>
      <pubDate>Fri, 20 Oct 2006 16:35:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/fiscal-date-shell-script/m-p/3884215#M280398</guid>
      <dc:creator>Monte Heeren</dc:creator>
      <dc:date>2006-10-20T16:35:20Z</dc:date>
    </item>
    <item>
      <title>Re: Fiscal Date Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/fiscal-date-shell-script/m-p/3884216#M280399</link>
      <description>Lots of ways to do this, no doubt, but here's a quick one off the top of my head:&lt;BR /&gt;&lt;BR /&gt;yearshort=$(echo $(($yearlong+1)) | cut -c 3-)</description>
      <pubDate>Fri, 20 Oct 2006 16:41:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/fiscal-date-shell-script/m-p/3884216#M280399</guid>
      <dc:creator>Jeff_Traigle</dc:creator>
      <dc:date>2006-10-20T16:41:03Z</dc:date>
    </item>
    <item>
      <title>Re: Fiscal Date Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/fiscal-date-shell-script/m-p/3884217#M280400</link>
      <description>Hi Monte:&lt;BR /&gt;&lt;BR /&gt;The easy way is to use formatted printing:&lt;BR /&gt;&lt;BR /&gt;# printf "The fiscal date is %d-%02d\n" $yearlong $yearshort &lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 20 Oct 2006 17:04:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/fiscal-date-shell-script/m-p/3884217#M280400</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-10-20T17:04:51Z</dc:date>
    </item>
    <item>
      <title>Re: Fiscal Date Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/fiscal-date-shell-script/m-p/3884218#M280401</link>
      <description>echo "This is a date test"&lt;BR /&gt;yearlong=$(date +%Y)&lt;BR /&gt;yearshort=$(date +%y)&lt;BR /&gt;echo "Year short --&amp;gt; " $yearshort&lt;BR /&gt;yearshort=$(($yearshort+1))&lt;BR /&gt;if [ $yearshort -lt 10 ]&lt;BR /&gt;then&lt;BR /&gt;echo "The fiscal date is $yearlong-0$yearshort"&lt;BR /&gt;else&lt;BR /&gt;echo "The fiscal date is $yearlong-$yearshort"&lt;BR /&gt;fi&lt;BR /&gt;exit&lt;BR /&gt;&lt;BR /&gt;Yang</description>
      <pubDate>Fri, 20 Oct 2006 18:02:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/fiscal-date-shell-script/m-p/3884218#M280401</guid>
      <dc:creator>Yang Qin_1</dc:creator>
      <dc:date>2006-10-20T18:02:13Z</dc:date>
    </item>
    <item>
      <title>Re: Fiscal Date Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/fiscal-date-shell-script/m-p/3884219#M280402</link>
      <description>Leading zeros are much simpler to implement using typeset:&lt;BR /&gt; &lt;BR /&gt;typeset -Z2 yearshort&lt;BR /&gt;yearshort=$(date +%y)&lt;BR /&gt;echo $yearshort&lt;BR /&gt; &lt;BR /&gt;typeset has a *lot* of formatting features for variables (UPPERCASE, lowercase, leading zeros, leading spaces, trailing spaces, etc)</description>
      <pubDate>Fri, 20 Oct 2006 20:22:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/fiscal-date-shell-script/m-p/3884219#M280402</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2006-10-20T20:22:26Z</dc:date>
    </item>
    <item>
      <title>Re: Fiscal Date Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/fiscal-date-shell-script/m-p/3884220#M280403</link>
      <description>Hi Monte,&lt;BR /&gt;&lt;BR /&gt;based on Mr. Hassel's suggestion: &lt;BR /&gt;&lt;BR /&gt;$ eval typeset -Z2 X=$(($(date +%y ) + 1)); date +%Y-${X}&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;John K.</description>
      <pubDate>Sat, 21 Oct 2006 12:44:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/fiscal-date-shell-script/m-p/3884220#M280403</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2006-10-21T12:44:16Z</dc:date>
    </item>
    <item>
      <title>Re: Fiscal Date Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/fiscal-date-shell-script/m-p/3884221#M280404</link>
      <description>Thank you to all that responded to this thread.  The easyest way to solve this was to use Jeff Traigle's example.&lt;BR /&gt;&lt;BR /&gt;Could not get the typeset example to work.&lt;BR /&gt;&lt;BR /&gt;Please close this thread!&lt;BR /&gt;&lt;BR /&gt;This is definitely a valueable resource center!&lt;BR /&gt;&lt;BR /&gt;Monte.</description>
      <pubDate>Tue, 24 Oct 2006 16:43:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/fiscal-date-shell-script/m-p/3884221#M280404</guid>
      <dc:creator>Monte Heeren</dc:creator>
      <dc:date>2006-10-24T16:43:10Z</dc:date>
    </item>
  </channel>
</rss>

