<?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 Shell Scripting.. in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/2568892#M30265</link>
    <description>How I can convert  234 to mmddyy format??&lt;BR /&gt;&lt;BR /&gt;date +%j  &lt;BR /&gt;234&lt;BR /&gt;&lt;BR /&gt;234 is 22nd Aug....How I can convert that and display in 082201 format.....I know we can do date +%m%d%y to get that format..But my script is giving output 234 and I want to convert that to mmddyy format??</description>
    <pubDate>Thu, 23 Aug 2001 03:09:10 GMT</pubDate>
    <dc:creator>Sejal Joshi</dc:creator>
    <dc:date>2001-08-23T03:09:10Z</dc:date>
    <item>
      <title>Shell Scripting..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/2568892#M30265</link>
      <description>How I can convert  234 to mmddyy format??&lt;BR /&gt;&lt;BR /&gt;date +%j  &lt;BR /&gt;234&lt;BR /&gt;&lt;BR /&gt;234 is 22nd Aug....How I can convert that and display in 082201 format.....I know we can do date +%m%d%y to get that format..But my script is giving output 234 and I want to convert that to mmddyy format??</description>
      <pubDate>Thu, 23 Aug 2001 03:09:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/2568892#M30265</guid>
      <dc:creator>Sejal Joshi</dc:creator>
      <dc:date>2001-08-23T03:09:10Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripting..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/2568893#M30266</link>
      <description>I am not sure if date command will allow us to convert the string back to your Aug 22 format. But there is a crude way of doing it using shell script. YOu need to make a table like this&lt;BR /&gt;&lt;BR /&gt;DEC:334&lt;BR /&gt;NOV:304&lt;BR /&gt;OCT:273&lt;BR /&gt;....&lt;BR /&gt;FEB:31&lt;BR /&gt;JAN:0&lt;BR /&gt;&lt;BR /&gt;let's call it daytable&lt;BR /&gt;&lt;BR /&gt;Let's store your string in a variable $STR&lt;BR /&gt;&lt;BR /&gt;This program will convert your string to month and day&lt;BR /&gt;&lt;BR /&gt;for i in `cat daytable`&lt;BR /&gt;do&lt;BR /&gt;MON=`echo $i|awk '{FS=":";print $1}'`&lt;BR /&gt;DAY=`echo $i|awk '{FS=":";print $2}'`&lt;BR /&gt;if [ $STR -ge $DAY ]&lt;BR /&gt;then&lt;BR /&gt;echo STR is $STR Day is $DAY&lt;BR /&gt;MYDAYS=`echo $STR - $DAY |bc`&lt;BR /&gt;echo "$MON - $MYDAYS"&lt;BR /&gt;exit&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;This will work only for this year. You need to change the values if you want for other years&lt;BR /&gt;&lt;BR /&gt;-Sri&lt;BR /&gt;</description>
      <pubDate>Thu, 23 Aug 2001 03:40:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/2568893#M30266</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2001-08-23T03:40:55Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripting..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/2568894#M30267</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Here's a perl script to do it, uses 2 arguments, day-of-year and year (default - this year), e.g.&lt;BR /&gt;&lt;BR /&gt;# doy2time.pl 40 1983&lt;BR /&gt;09-02-1983&lt;BR /&gt;# doy2time.pl 269&lt;BR /&gt;26-09-2001&lt;BR /&gt;&lt;BR /&gt;========================================&lt;BR /&gt;#!/opt/perl5/bin/perl&lt;BR /&gt;&lt;BR /&gt;if ( $#ARGV eq 0 ) {&lt;BR /&gt; $year=1900+(localtime)[5];&lt;BR /&gt;}&lt;BR /&gt;else {&lt;BR /&gt; $year=$ARGV[1];&lt;BR /&gt;}&lt;BR /&gt;$doy=$ARGV[0];&lt;BR /&gt;$numdays=-1;&lt;BR /&gt;for ( $y=1970 ; $y &amp;lt; $year ; $y++ ) {&lt;BR /&gt; $numdays+=365;&lt;BR /&gt; $rem=$y%4;&lt;BR /&gt; $numdays+=1 if ( $rem == 0 ) ;&lt;BR /&gt;}&lt;BR /&gt;$numdays+=$doy;&lt;BR /&gt;$numdays*=24*3600;&lt;BR /&gt;($d,$m)=(localtime($numdays))[3,4];&lt;BR /&gt;printf ("%02d-%02d-%04d\n",$d,$m+1,$year);&lt;BR /&gt;===========================================&lt;BR /&gt;&lt;BR /&gt;Rgds, Robin.</description>
      <pubDate>Thu, 23 Aug 2001 07:14:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/2568894#M30267</guid>
      <dc:creator>Robin Wakefield</dc:creator>
      <dc:date>2001-08-23T07:14:05Z</dc:date>
    </item>
  </channel>
</rss>

