<?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: Difference between two dates? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/difference-between-two-dates/m-p/2702732#M901867</link>
    <description>This is a job for CalMan! &lt;BR /&gt;Here he comes to save the day....pun intended :~)&lt;BR /&gt;&lt;BR /&gt;Jeff</description>
    <pubDate>Fri, 12 Apr 2002 14:40:50 GMT</pubDate>
    <dc:creator>Jeff Schussele</dc:creator>
    <dc:date>2002-04-12T14:40:50Z</dc:date>
    <item>
      <title>Difference between two dates?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/difference-between-two-dates/m-p/2702731#M901866</link>
      <description>Hello Experts,&lt;BR /&gt;&lt;BR /&gt;Is there an easy way to determine in a script the number of days between two dates?&lt;BR /&gt;&lt;BR /&gt;TIA, John W.</description>
      <pubDate>Fri, 12 Apr 2002 14:37:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/difference-between-two-dates/m-p/2702731#M901866</guid>
      <dc:creator>John Wolfe_1</dc:creator>
      <dc:date>2002-04-12T14:37:39Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between two dates?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/difference-between-two-dates/m-p/2702732#M901867</link>
      <description>This is a job for CalMan! &lt;BR /&gt;Here he comes to save the day....pun intended :~)&lt;BR /&gt;&lt;BR /&gt;Jeff</description>
      <pubDate>Fri, 12 Apr 2002 14:40:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/difference-between-two-dates/m-p/2702732#M901867</guid>
      <dc:creator>Jeff Schussele</dc:creator>
      <dc:date>2002-04-12T14:40:50Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between two dates?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/difference-between-two-dates/m-p/2702733#M901868</link>
      <description>Hi John:&lt;BR /&gt;&lt;BR /&gt;Yes, this is about as easy as it gets:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;DT1="12 30 1900"&lt;BR /&gt;DT2="12 31 2005"&lt;BR /&gt;&lt;BR /&gt;DIFF=$(($(caljd.sh ${DT2}) - $(caljd.sh ${DT1})))&lt;BR /&gt;echo "${DT1} and ${DT2} differ by ${DIFF} days."&lt;BR /&gt;&lt;BR /&gt;Note, that this method will work across huge date ranges which lie outside the range of epoch seconds.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;You can also use the Date::Calc Perl module.&lt;BR /&gt;&lt;BR /&gt;You can do a caljd.sh -u for full usage.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards, Clay&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 12 Apr 2002 14:42:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/difference-between-two-dates/m-p/2702733#M901868</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-04-12T14:42:44Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between two dates?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/difference-between-two-dates/m-p/2702734#M901869</link>
      <description>Hi again John:&lt;BR /&gt;&lt;BR /&gt;You see that little button that is labeled 'Search'. You probably should have used it first and searches for something like 'date' and 'differnece' and I suspect that you would have found a few hits.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 12 Apr 2002 14:45:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/difference-between-two-dates/m-p/2702734#M901869</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-04-12T14:45:25Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between two dates?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/difference-between-two-dates/m-p/2702735#M901870</link>
      <description>Eek!&lt;BR /&gt;&lt;BR /&gt;Good luck... This is probably one of the few areas where perl would actually be better than shell/awk!&lt;BR /&gt;&lt;BR /&gt;As a way of abusing this - it depends on the date format, if it's saved as 'date +%j' format it is easy:&lt;BR /&gt;&lt;BR /&gt;   $ date +%j&lt;BR /&gt;   200&lt;BR /&gt;   [100 days later]&lt;BR /&gt;   $ date +%j&lt;BR /&gt;   300&lt;BR /&gt;&lt;BR /&gt;If it's done using the normal date format, then that makes it harder. *even* harder if it breaches a) the month and b) the year boundary.&lt;BR /&gt;&lt;BR /&gt;Here is an attempt; I don't expect it to work first time :-)&lt;BR /&gt;&lt;BR /&gt;----------------&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;# $1 = date in dd/mm/yyyy&lt;BR /&gt;function numdays&lt;BR /&gt;{&lt;BR /&gt;   integer day=${1%%/*}&lt;BR /&gt;   typeset month=${1%/*}&lt;BR /&gt;   integer month=${month#*/}&lt;BR /&gt;   integer year=${1##*/}&lt;BR /&gt;&lt;BR /&gt;   integer days=${day}&lt;BR /&gt;# now we need to work out the amount of dates in the year&lt;BR /&gt;   while (( month &amp;gt; 1 ))&lt;BR /&gt;   do&lt;BR /&gt;      days=$(( ${days} + $(cal ${month} ${year}| awk 'BEGIN {RS="\\n"} {print NF}') ))&lt;BR /&gt;      month=$(( ${month} - 1 ))&lt;BR /&gt;   done&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;First=$(numdays 12/04/2002)&lt;BR /&gt;Second=$(numdays 10/02/2002)&lt;BR /&gt;&lt;BR /&gt;print (( Second - First ))&lt;BR /&gt;&lt;BR /&gt;----------------&lt;BR /&gt;&lt;BR /&gt;Doing the years is left as an exercise to the reader :-)&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;&lt;BR /&gt;dave</description>
      <pubDate>Fri, 12 Apr 2002 15:11:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/difference-between-two-dates/m-p/2702735#M901870</guid>
      <dc:creator>David Lodge</dc:creator>
      <dc:date>2002-04-12T15:11:58Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between two dates?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/difference-between-two-dates/m-p/2702736#M901871</link>
      <description>John,&lt;BR /&gt;&lt;BR /&gt;This discussion might help you ...&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xea948cc5e03fd6118fff0090279cd0f9,00.html" target="_blank"&gt;http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xea948cc5e03fd6118fff0090279cd0f9,00.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Shabu</description>
      <pubDate>Fri, 12 Apr 2002 16:08:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/difference-between-two-dates/m-p/2702736#M901871</guid>
      <dc:creator>SHABU KHAN</dc:creator>
      <dc:date>2002-04-12T16:08:02Z</dc:date>
    </item>
  </channel>
</rss>

