<?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: Continuous day count in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/continuous-day-count/m-p/4749933#M41130</link>
    <description>&lt;!--!*#--&gt;&amp;gt;&amp;gt; I expected 8340 not 8338. Below is me running it:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;A little late, but you are correct.&lt;BR /&gt;I managed to paste a wrong version of the &lt;BR /&gt;code.&lt;BR /&gt;&lt;BR /&gt;The leapyear test should be done before the increment. Sorry. &lt;BR /&gt;&lt;BR /&gt;That makes it 8339.&lt;BR /&gt;It becomes 8340 if you want to count inclusive of start and end date for a duration.&lt;BR /&gt;&lt;BR /&gt;The reason why this reply is so late is because I wanted to point out that it was not &lt;BR /&gt;my intention to edit the file for a specific start, but to just use an early enough date to handle start and end.&lt;BR /&gt;&lt;BR /&gt;I used 17_NOV_1858 because that's the OpenVMS limit.&lt;BR /&gt;&lt;BR /&gt;Next I tried 1-JAN-1900 because that's the EXCEL base date for use with DATEVALUE.&lt;BR /&gt;Handy for testing I thought....&lt;BR /&gt;Except that those amateurs at Microsoft got it wrong!&lt;BR /&gt;They have year 1900 as a Leap Year! Argh!&lt;BR /&gt;So I wasted a good bit of time getting confused by that + my own calculation order problem.&lt;BR /&gt;&lt;BR /&gt;Excel::&lt;BR /&gt;text datevalue&lt;BR /&gt;1/1/1900 1&lt;BR /&gt;2/28/1900 59&lt;BR /&gt;3/1/1900 61&lt;BR /&gt; &lt;BR /&gt;2/8/2011 40582&lt;BR /&gt;4/10/1988 32243&lt;BR /&gt; 8339&lt;BR /&gt;&lt;BR /&gt;I guess a handy base date is 1/1/1970.&lt;BR /&gt;That's the Unix base date ( UTC )&lt;BR /&gt;&lt;BR /&gt;The code below gives:&lt;BR /&gt;&lt;BR /&gt;$ @DAY_SINCE_1_JAN_1970.COM 11-feb-2011:04:40&lt;BR /&gt;11-FEB-2011:04:40 is 15016 days since 1_jan_1970. Unix Epoch Seconds: 1297399200&lt;BR /&gt;&lt;BR /&gt;Confirmed with:&lt;BR /&gt;&lt;BR /&gt;$ perl -e "print time"&lt;BR /&gt;1297399257&lt;BR /&gt;&lt;BR /&gt;and also&lt;BR /&gt;&lt;BR /&gt;$  @DAY_SINCE_1_JAN_1970.COM 1-jan-1970&lt;BR /&gt;1-JAN-1970 is 0 days since 1_jan_1970. Unix Epoch Seconds: 0&lt;BR /&gt;&lt;BR /&gt;$  @DAY_SINCE_1_JAN_1970.COM 2-jan-1970&lt;BR /&gt;2-JAN-1970 is 1 days since 1_jan_1970. Unix Epoch Seconds: 86400&lt;BR /&gt;&lt;BR /&gt;$ type DAY_SINCE_1_JAN_1970.COM&lt;BR /&gt;$&lt;BR /&gt;$ target = 123 ! This integer will become a string if Convert time works&lt;BR /&gt;$ target =  F$CVT(P1,"ABSOLUTE","DATE")&lt;BR /&gt;$ IF F$TYPE(target) .NES. "STRING" THEN EXIT 16&lt;BR /&gt;$ year = 1969&lt;BR /&gt;$ days = -365&lt;BR /&gt;$ target_year = 'F$CVT( target,,"YEAR")&lt;BR /&gt;$&lt;BR /&gt;$year_loop:&lt;BR /&gt;$ year = year + 1&lt;BR /&gt;$ IF F$CVTIME("1-MAR-''year' -1-",,"DAY") THEN days = days + 1&lt;BR /&gt;$ days = days + 365&lt;BR /&gt;$ IF year.LT.target_year THEN GOTO year_loop&lt;BR /&gt;$&lt;BR /&gt;$ date = "1-JAN-''year'"&lt;BR /&gt;$day_loop:&lt;BR /&gt;$ IF date .EQS.target THEN GOTO done&lt;BR /&gt;$ date = F$CVT("''date' +1-","ABSOLUTE","DATE")&lt;BR /&gt;$ days = days + 1&lt;BR /&gt;$ goto day_loop&lt;BR /&gt;$&lt;BR /&gt;$ done:&lt;BR /&gt;$ seconds = days*86400 + 3600*F$CVT(p1,,"HOUR") + 60*F$CVT(p1,,"MINUTE") + F$CVT(p1,,"SECOND")&lt;BR /&gt;$ write sys$output p1, " is ", days, " days since 1_jan_1970. Unix Epoch Seconds: ", seconds&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Hein&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;btw... the website I referred to reports:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.convertunits.com/dates/from/Apr+10,+1988/to/Feb+8,+2011" target="_blank"&gt;http://www.convertunits.com/dates/from/Apr+10,+1988/to/Feb+8,+2011&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;"The total number of days between Sunday, April 10th, 1988 and Tuesday, February 8th, 2011 is 8,339 days.&lt;BR /&gt;&lt;BR /&gt;This is equal to exactly 22 years, 9 months, and 29 days.&lt;BR /&gt;&lt;BR /&gt;This does not include the end date, so it's accurate if you're measuring your age in days, or the total days between the start and end date. But if you want the duration of an event that includes both the starting date and the ending date, then it would actually be 8,340 days.&lt;BR /&gt;&lt;BR /&gt;The total time span from 1988-04-10 to 2011-02-08 is 200,136 hours.&lt;BR /&gt;&lt;BR /&gt;This is equivalent to 12,008,160 minutes.&lt;BR /&gt;&lt;BR /&gt;You can also convert 8,339 days to 720,489,600 seconds."&lt;BR /&gt;&lt;BR /&gt;Hein&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Fri, 11 Feb 2011 05:51:34 GMT</pubDate>
    <dc:creator>Hein van den Heuvel</dc:creator>
    <dc:date>2011-02-11T05:51:34Z</dc:date>
    <item>
      <title>Continuous day count</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/continuous-day-count/m-p/4749913#M41110</link>
      <description>&lt;!--!*#--&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;Is there some way in VMS of getting the number of days since a certain date to today? To be precise the number of days since the 10th of April 1988 to today. I currently use a simple excel spreadsheet and enter the value myself, but if VMS can calculate this number for me it would be great.&lt;BR /&gt;&lt;BR /&gt;Kind Regards,&lt;BR /&gt;&lt;BR /&gt;Niall</description>
      <pubDate>Tue, 08 Feb 2011 12:49:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/continuous-day-count/m-p/4749913#M41110</guid>
      <dc:creator>Niall76</dc:creator>
      <dc:date>2011-02-08T12:49:00Z</dc:date>
    </item>
    <item>
      <title>Re: Continuous day count</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/continuous-day-count/m-p/4749914#M41111</link>
      <description>&lt;BR /&gt;See HELP LEXICAL F$DELTA_TIME.&lt;BR /&gt;&lt;BR /&gt;If You have a system older than VMS 7.3-2 and a fortran compiler, then You may use my version at&lt;BR /&gt; &lt;A href="http://wwwvms.mpp.mpg.de/~huber/util/main/f$delta_time.HTML" target="_blank"&gt;http://wwwvms.mpp.mpg.de/~huber/util/main/f$delta_time.HTML&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 08 Feb 2011 12:58:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/continuous-day-count/m-p/4749914#M41111</guid>
      <dc:creator>Joseph Huber_1</dc:creator>
      <dc:date>2011-02-08T12:58:12Z</dc:date>
    </item>
    <item>
      <title>Re: Continuous day count</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/continuous-day-count/m-p/4749915#M41112</link>
      <description>&lt;!--!*#--&gt;Hi Joseph,&lt;BR /&gt;&lt;BR /&gt;Yes I'm only running version 7.3.  I was hoping that this could be done using a Lexical function of some sort. Is this possible?&lt;BR /&gt;&lt;BR /&gt;Regards and Thanks,&lt;BR /&gt;&lt;BR /&gt;Niall</description>
      <pubDate>Tue, 08 Feb 2011 13:25:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/continuous-day-count/m-p/4749915#M41112</guid>
      <dc:creator>Niall76</dc:creator>
      <dc:date>2011-02-08T13:25:53Z</dc:date>
    </item>
    <item>
      <title>Re: Continuous day count</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/continuous-day-count/m-p/4749916#M41113</link>
      <description>F$delta_time IS the lexical function You are asking for, but was introduced only with VMS 7.3-2.&lt;BR /&gt;&lt;BR /&gt;So either use my replacement program, or search for some earlier DCL command-files doing the calculation in pure DCL, I think at dcl.openvms.org there was one posted.</description>
      <pubDate>Tue, 08 Feb 2011 13:30:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/continuous-day-count/m-p/4749916#M41113</guid>
      <dc:creator>Joseph Huber_1</dc:creator>
      <dc:date>2011-02-08T13:30:40Z</dc:date>
    </item>
    <item>
      <title>Re: Continuous day count</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/continuous-day-count/m-p/4749917#M41114</link>
      <description>The DCL-only solution was posted by R.Boyd at&lt;BR /&gt;&lt;BR /&gt; &lt;A href="http://dcl.openvms.org/stories.php?story=07/01/16/4051929" target="_blank"&gt;http://dcl.openvms.org/stories.php?story=07/01/16/4051929&lt;/A&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 08 Feb 2011 14:02:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/continuous-day-count/m-p/4749917#M41114</guid>
      <dc:creator>Joseph Huber_1</dc:creator>
      <dc:date>2011-02-08T14:02:26Z</dc:date>
    </item>
    <item>
      <title>Re: Continuous day count</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/continuous-day-count/m-p/4749918#M41115</link>
      <description>&lt;!--!*#--&gt;Thanks Joseph for everything so far, but please can you help me with this Com file. I can't seem to be able to enter in the required paramters correctly. I'm sure I'm making a hash of it. &lt;BR /&gt;This is what I enter and get nothing back at all, not even an error:&lt;BR /&gt;@time_difference.com; 16-JAN-2008:13:40:00 DELTA_TIME "TIME" 16-JAN-2007:13:40:00&lt;BR /&gt;&lt;BR /&gt;Thanks again,&lt;BR /&gt;Niall</description>
      <pubDate>Tue, 08 Feb 2011 14:48:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/continuous-day-count/m-p/4749918#M41115</guid>
      <dc:creator>Niall76</dc:creator>
      <dc:date>2011-02-08T14:48:03Z</dc:date>
    </item>
    <item>
      <title>Re: Continuous day count</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/continuous-day-count/m-p/4749919#M41116</link>
      <description>For me it works:&lt;BR /&gt;&lt;BR /&gt;@time_difference 16-JAN-2008:13:40:00  delta_time  "TIME"  16-JAN-2007:13:40:00&lt;BR /&gt;sh sym delta_time&lt;BR /&gt;  DELTA_TIME == "+364-00:00:00.00"&lt;BR /&gt;&lt;BR /&gt;Lost something in downloading from dcl.openvms.org ?</description>
      <pubDate>Tue, 08 Feb 2011 15:07:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/continuous-day-count/m-p/4749919#M41116</guid>
      <dc:creator>Joseph Huber_1</dc:creator>
      <dc:date>2011-02-08T15:07:54Z</dc:date>
    </item>
    <item>
      <title>Re: Continuous day count</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/continuous-day-count/m-p/4749920#M41117</link>
      <description>&lt;!--!*#--&gt;Nope! I just never showed symbol afterwards.&lt;BR /&gt;&lt;BR /&gt;So this works, kind off. for some reason the day i was in 1988 does not, but one year later it does.  Any ideas?&lt;BR /&gt;&lt;BR /&gt;Prompt&amp;gt; @time_difference 10-Apr-1989:12:00:00 delta_time "TIME" 8-FEB-2011:00:00:00&lt;BR /&gt;Prompt&amp;gt; sh sym DELTA_TIME&lt;BR /&gt;  DELTA_TIME == "-7974-12:00:00.00"&lt;BR /&gt;Prompt&amp;gt; @time_difference 10-Apr-1988:12:00:00 delta_time "TIME" 8-FEB-2011:00:00:00&lt;BR /&gt;%DCL-W-IVATIME, invalid absolute time - use DD-MMM-YYYY:HH:MM:SS.CC format&lt;BR /&gt; \8-FEB-2011 00:00:00.00-16383-0:0\&lt;BR /&gt;%DCL-W-IVATIME, invalid absolute time - use DD-MMM-YYYY:HH:MM:SS.CC format&lt;BR /&gt; \8-FEB-2011 00:00:00.00-32767-0:0\&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Niall</description>
      <pubDate>Tue, 08 Feb 2011 15:30:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/continuous-day-count/m-p/4749920#M41117</guid>
      <dc:creator>Niall76</dc:creator>
      <dc:date>2011-02-08T15:30:22Z</dc:date>
    </item>
    <item>
      <title>Re: Continuous day count</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/continuous-day-count/m-p/4749921#M41118</link>
      <description>The problem with F$DELTA is that it is limited to 9999 days... roughly 25 years.&lt;BR /&gt;&lt;BR /&gt;So to use it properly you'd  have to go through the years in chunks of less than 9999 days.&lt;BR /&gt;See example below.&lt;BR /&gt;&lt;BR /&gt;Google finds a good few examples, and the  TIME_DIFFERENCE one on OpenVMS.org is fine, but a bit much.&lt;BR /&gt;A cure but noisy, general purpose example is:&lt;BR /&gt;&lt;A href="http://www.convertunits.com/dates/from/Nov+17,+1858/to/Feb+8,+2011" target="_blank"&gt;http://www.convertunits.com/dates/from/Nov+17,+1858/to/Feb+8,+2011&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Brute forcing through the years and days instead of a binary search works fine as well, or you can just use math as in other examples. &lt;BR /&gt;The example below uses the fact the  '29' it odd, thus has the low bit set, and thus is TRUE, whereas 28 is false, to adjust for leap years.&lt;BR /&gt;&lt;BR /&gt;Below two examples to just calculate the days since a reference date (not before 17-NOV-1858). &lt;BR /&gt;&lt;BR /&gt;You can edit in your own reference date to speed it up a little if need be.&lt;BR /&gt;&lt;BR /&gt;Turn into a subroutine as needed to calculate   a difference.&lt;BR /&gt;&lt;BR /&gt;Hein&lt;BR /&gt;&lt;BR /&gt;$ type DAY_SINCE_17_NOV_1858.com&lt;BR /&gt;$&lt;BR /&gt;$ target = 123 ! This integer will become a string if Convert time works&lt;BR /&gt;$ target =  F$CVT(P1,"ABSOLUTE","DATE")&lt;BR /&gt;$ IF F$TYPE(target) .NES. "STRING" THEN EXIT 16&lt;BR /&gt;$ year = 1858&lt;BR /&gt;$ days = 45 - 365&lt;BR /&gt;$ target_year = 'F$CVT( target,,"YEAR")&lt;BR /&gt;$&lt;BR /&gt;$year_loop:&lt;BR /&gt;$ year = year + 1&lt;BR /&gt;$ days = days + 365&lt;BR /&gt;$ IF F$CVTIME("1-MAR-''year' -1-",,"DAY") THEN days = days + 1   ! 28=false, 29=true&lt;BR /&gt;$ IF year.LT.target_year THEN GOTO year_loop&lt;BR /&gt;$&lt;BR /&gt;$ date = "1-JAN-''year'"&lt;BR /&gt;$day_loop:&lt;BR /&gt;$ IF date .EQS.target THEN GOTO done&lt;BR /&gt;$ date = F$CVT("''date' +1-","ABSOLUTE","DATE")&lt;BR /&gt;$ days = days + 1&lt;BR /&gt;$ goto day_loop&lt;BR /&gt;$&lt;BR /&gt;$ done:&lt;BR /&gt;$ write sys$output p1, " is ", days, " days since 17-NOV-1858 "&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;For OpenVMS 7.3-2 or better with F$DELTA&lt;BR /&gt;&lt;BR /&gt;$&lt;BR /&gt;$ target = 123 ! This integer will become a string if Convert time works&lt;BR /&gt;$ target =  F$CVT(P1,"ABSOLUTE","DATE")&lt;BR /&gt;$ IF F$TYPE(target) .NES. "STRING" THEN EXIT 16&lt;BR /&gt;$ days = 0&lt;BR /&gt;$ start_date = "17-NOV-"&lt;BR /&gt;$ start_year = 1858&lt;BR /&gt;$ target_year = 'F$CVT( target,,"YEAR")&lt;BR /&gt;$ target_date = target - "''target_year'"&lt;BR /&gt;$chunck_loop:&lt;BR /&gt;$ IF ( target_year - start_year ) .LE. 25 THEN GOTO last_chunck&lt;BR /&gt;$ start_next = start_year + 25&lt;BR /&gt;$ days = days + f$elem(0," ",f$delta( start_date + "''start_year'", start_date + "''start_next'" ))&lt;BR /&gt;$ start_year = start_next&lt;BR /&gt;$ goto chunck_loop&lt;BR /&gt;$&lt;BR /&gt;$last_chunck:&lt;BR /&gt;$ dddd = f$delta( start_date + "''start_year'", target)&lt;BR /&gt;$ days = days + f$elem(0," ", f$edit( dddd, "TRIM" ))&lt;BR /&gt;$ write sys$output p1, " is ", days, " days since 17-NOV-1858 "&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 08 Feb 2011 15:39:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/continuous-day-count/m-p/4749921#M41118</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2011-02-08T15:39:35Z</dc:date>
    </item>
    <item>
      <title>Re: Continuous day count</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/continuous-day-count/m-p/4749922#M41119</link>
      <description>from 10-Apr-1988 to today is less than 9999, it is only 8340 by my calculations so the com file should still have worked, yes?&lt;BR /&gt;&lt;BR /&gt;Just if it is fails with less than 9999, then it will probably fail also with looping it.&lt;BR /&gt;&lt;BR /&gt;Maybe it possible to add a value to the returned DELTA_TIME. Say the number of days from 10-APR-1988 to 31-Jan-1999 and then add this number of days to the returned DELTA_TIME and use the start date to be 01-Jan-2000. How do i do that then...  :)&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Niall</description>
      <pubDate>Tue, 08 Feb 2011 15:50:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/continuous-day-count/m-p/4749922#M41119</guid>
      <dc:creator>Niall76</dc:creator>
      <dc:date>2011-02-08T15:50:01Z</dc:date>
    </item>
    <item>
      <title>Re: Continuous day count</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/continuous-day-count/m-p/4749923#M41120</link>
      <description>&amp;gt;&amp;gt; Maybe it possible to add a value to the returned DELTA_TIME. Say the number of days from 10-APR-1988 to 31-Jan-1999 and then add this number of days to the returned DELTA_TIME and use the start date to be 01-Jan-2000. How do i do that then... :)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;That's exactly what my second example does in a very generic format, using 25 year chunks since the beginning of (OpenVMS) time.&lt;BR /&gt;&lt;BR /&gt;You could easily simplify picking a different reference date for which you know you will need only one more F$DELTA and stay in that range for the supported future or the script.&lt;BR /&gt;&lt;BR /&gt;Your example...&lt;BR /&gt;&lt;BR /&gt;$ write sys$output F$DELTA ( "10-APR-1988", "01-Jan-2000")&lt;BR /&gt;4283 00:00:00.00&lt;BR /&gt;$ write sys$output F$DELTA ( "01-Jan-2000", "08-Feb-2011")&lt;BR /&gt;4056 00:00:00.00&lt;BR /&gt;$ write sys$output F$DELTA ( "10-APR-1988", "08-Feb-2011")&lt;BR /&gt;8339 00:00:00.00&lt;BR /&gt;$ write sys$output 4283 + 4056&lt;BR /&gt;8339&lt;BR /&gt;&lt;BR /&gt;Hein&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 08 Feb 2011 15:59:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/continuous-day-count/m-p/4749923#M41120</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2011-02-08T15:59:01Z</dc:date>
    </item>
    <item>
      <title>Re: Continuous day count</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/continuous-day-count/m-p/4749924#M41121</link>
      <description>Well, define debug$dcl 1, then You will see&lt;BR /&gt;&lt;BR /&gt;$  new_time = f$cvtime(f$fao(bformat,delta_value),,component)&lt;BR /&gt;%DCL-W-IVATIME, invalid absolute time - use DD-MMM-YYYY:HH:MM:SS.CC format&lt;BR /&gt; \8-FEB-2011 13:40:00.00-16383-0:0\&lt;BR /&gt;&lt;BR /&gt;Seems the author is doubling the delta-time testing iteratively. And since the difference is &amp;gt;8192 , next is 163nn, giving an illegal combined time for DCL.&lt;BR /&gt;So this time_difference.com in fact is not working up to 9999 days, but only for something like 8192.&lt;BR /&gt;&lt;BR /&gt;Or use my above mentioned program, it works definetly up to 9999 days:&lt;BR /&gt;&lt;BR /&gt;f$delta_time/log temp 10-Apr-1988:13:40:00   8-FEB-2011:13:40:00&lt;BR /&gt;8339 00:00:00.00&lt;BR /&gt;&lt;BR /&gt;BTW, if You are interested in just counting days, then there is another possibility:&lt;BR /&gt;use a "Julian Day number" routine like LIB$DAY for the two dates, and take the difference of the two resulting numbers: this  works for dates back to the modified Julian Date day 0 of 17-NOV-1859.&lt;BR /&gt;Or even a general julian date program jd* like I have on &lt;BR /&gt; &lt;A href="http://wwwvms.mpp.mpg.de/~huber/util/" target="_blank"&gt;http://wwwvms.mpp.mpg.de/~huber/util/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 08 Feb 2011 15:59:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/continuous-day-count/m-p/4749924#M41121</guid>
      <dc:creator>Joseph Huber_1</dc:creator>
      <dc:date>2011-02-08T15:59:56Z</dc:date>
    </item>
    <item>
      <title>Re: Continuous day count</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/continuous-day-count/m-p/4749925#M41122</link>
      <description>Using &lt;BR /&gt; &lt;A href="http://wwwvms.mpp.mpg.de/~huber/util/main/mjdv.for" target="_blank"&gt;http://wwwvms.mpp.mpg.de/~huber/util/main/mjdv.for&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;it is as short as:&lt;BR /&gt;&lt;BR /&gt;MPIW10_HUB&amp;gt;@day_diff 1-jan-1982 today&lt;BR /&gt;44970&lt;BR /&gt;55600&lt;BR /&gt;  TDIFF = 10630   Hex = 00002986  Octal = 00000024606&lt;BR /&gt;&lt;BR /&gt;$!day_diff.com:&lt;BR /&gt;$ mjdv 'p1'&lt;BR /&gt;$ d1=f$integer(mjdn)&lt;BR /&gt;$ mjdv 'p2'&lt;BR /&gt;$ d2=f$integer(mjdn)&lt;BR /&gt;$ tdiff=d2-d1&lt;BR /&gt;$ show symbol tdiff&lt;BR /&gt;</description>
      <pubDate>Tue, 08 Feb 2011 16:25:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/continuous-day-count/m-p/4749925#M41122</guid>
      <dc:creator>Joseph Huber_1</dc:creator>
      <dc:date>2011-02-08T16:25:12Z</dc:date>
    </item>
    <item>
      <title>Re: Continuous day count</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/continuous-day-count/m-p/4749926#M41123</link>
      <description>&lt;!--!*#--&gt;omg! My head is getting sore now :)&lt;BR /&gt;&lt;BR /&gt;I can't make head nor tail from that last link you posted, can you paste the text in here.&lt;BR /&gt;&lt;BR /&gt;I looked at your julian day counter, but it appears to be two days wrong or I miss counted somewhere. I expected 8340 not 8338. Below is me running it:&lt;BR /&gt;&lt;BR /&gt;Prompt&amp;gt; @DAY_SINCE_10_APR_1988 8-FEB-2011:13:40:00&lt;BR /&gt;$ TYP DAY_SINCE_10_APR_1988.COM;&lt;BR /&gt;$ target = 123 ! This integer will become a string if Convert time works&lt;BR /&gt;$ target = F$CVT(P1,"ABSOLUTE","DATE")&lt;BR /&gt;$ IF F$TYPE(target) .NES. "STRING" THEN EXIT 16&lt;BR /&gt;$ year = 1988&lt;BR /&gt;$ days = 265 - 365&lt;BR /&gt;$ target_year = 'F$CVT( target,,"YEAR")&lt;BR /&gt;$&lt;BR /&gt;$year_loop:&lt;BR /&gt;$ year = year + 1&lt;BR /&gt;$ days = days + 365&lt;BR /&gt;$ IF F$CVTIME("1-MAR-''year' -1-",,"DAY") THEN days = days + 1 ! 28=false, 29=true&lt;BR /&gt;$ IF year.LT.target_year THEN GOTO year_loop&lt;BR /&gt;$&lt;BR /&gt;$ date = "1-JAN-''year'"&lt;BR /&gt;$day_loop:&lt;BR /&gt;$ IF date .EQS.target THEN GOTO done&lt;BR /&gt;$ date = F$CVT("''date' +1-","ABSOLUTE","DATE")&lt;BR /&gt;$ days = days + 1&lt;BR /&gt;$ goto day_loop&lt;BR /&gt;$&lt;BR /&gt;$ done:&lt;BR /&gt;$ write sys$output p1, " is ", days, " days since 10-Apr-1988 "&lt;BR /&gt;8-FEB-2011:13:40:00 is 8338 days since 10-Apr-1988 &lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Niall&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 08 Feb 2011 16:38:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/continuous-day-count/m-p/4749926#M41123</guid>
      <dc:creator>Niall76</dc:creator>
      <dc:date>2011-02-08T16:38:26Z</dc:date>
    </item>
    <item>
      <title>Re: Continuous day count</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/continuous-day-count/m-p/4749927#M41124</link>
      <description>Niall, are You referring to&lt;BR /&gt; &lt;A href="http://wwwvms.mpp.mpg.de/~huber/util/main/mjdv.for" target="_blank"&gt;http://wwwvms.mpp.mpg.de/~huber/util/main/mjdv.for&lt;/A&gt; ?&lt;BR /&gt;If You are using MS internet explorer, then yes, it does not deal right with .FOR files :-)&lt;BR /&gt;I attach it .&lt;BR /&gt;My run looks like&lt;BR /&gt; day_diff 10-APR-1988 today&lt;BR /&gt;8339&lt;BR /&gt;&lt;BR /&gt;So it is correctly calculating days between dates, just add 1 in the day_diff.com above tdiff=d2-d1+1&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 08 Feb 2011 18:54:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/continuous-day-count/m-p/4749927#M41124</guid>
      <dc:creator>Joseph Huber_1</dc:creator>
      <dc:date>2011-02-08T18:54:41Z</dc:date>
    </item>
    <item>
      <title>Re: Continuous day count</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/continuous-day-count/m-p/4749928#M41125</link>
      <description>Niall,&lt;BR /&gt;&lt;BR /&gt;  This procedure will work on V7.2. I believe it's the fastest possible implementation (left as an exercise to figure out how it works ;-)&lt;BR /&gt;&lt;BR /&gt;  I did have a version that worked for ranges greater than 10000 days, but I can't find it at the moment.&lt;BR /&gt;&lt;BR /&gt;@SUBTIMES "10-APR-1988" "TODAY"&lt;BR /&gt;  DELTA == "8340 00:00:00.00"&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;SUBTIMES.COM&lt;BR /&gt;$ ON WARNING THEN EXIT&lt;BR /&gt;$ tt=F$CVTIME(p1)&lt;BR /&gt;$ GOSUB x&lt;BR /&gt;$ b0=d&lt;BR /&gt;$ tt=F$CVTIME(p2)&lt;BR /&gt;$ GOSUB x&lt;BR /&gt;$ b1=d&lt;BR /&gt;$ d[32,32]=%XF0000000&lt;BR /&gt;$ d[0,32]=0&lt;BR /&gt;$ l0=F$CVUI(0,30,b0)&lt;BR /&gt;$ l1=F$CVUI(0,30,b1)&lt;BR /&gt;$ IF l0.LT.l1&lt;BR /&gt;$ THEN&lt;BR /&gt;$   d[0,30]=.NOT.((l1-l0).AND.%X3FFFFFFF)&lt;BR /&gt;$   d[30,30]=.NOT.(F$CVUI(30,30,b1)-F$CVUI(30,30,b0))&lt;BR /&gt;$ ELSE&lt;BR /&gt;$   d[0,30]=.NOT.((%X40000000+l1-l0).AND.%X3FFFFFFF)&lt;BR /&gt;$   d[30,30]=.NOT.(F$CVUI(30,30,b1)-F$CVUI(30,30,b0)-1)&lt;BR /&gt;$ ENDIF&lt;BR /&gt;$ delta==F$FAO("!%D",F$CVUI(32,32,F$FAO("!AD",8,d)))&lt;BR /&gt;$ SHOW SYM delta&lt;BR /&gt;$ EXIT&lt;BR /&gt;$ x:&lt;BR /&gt;$   d[32,32]=0&lt;BR /&gt;$   d[0,32]=0&lt;BR /&gt;$   b=60&lt;BR /&gt;$   Loop: d[b,1]=1&lt;BR /&gt;$     IF F$CVTIME(F$FAO("!%D",F$CVUI(32,32,F$FAO("!AD",8,d)))).GTS.tt THEN d[b,1]=0&lt;BR /&gt;$     b=b-1&lt;BR /&gt;$   IF b.GT.0 THEN GOTO loop&lt;BR /&gt;$ RETURN</description>
      <pubDate>Tue, 08 Feb 2011 22:30:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/continuous-day-count/m-p/4749928#M41125</guid>
      <dc:creator>John Gillings</dc:creator>
      <dc:date>2011-02-08T22:30:30Z</dc:date>
    </item>
    <item>
      <title>Re: Continuous day count</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/continuous-day-count/m-p/4749929#M41126</link>
      <description>Niall,&lt;BR /&gt;&lt;BR /&gt;  Actually, since you only want DAYS between dates (as opposed to a delta time between two absolute datetimes), it's much easier. &lt;BR /&gt;&lt;BR /&gt;This procedure will calculate the number of days between any two dates from 17-NOV-1858 through to 18-JUN-9990. First parameter is the start date, second is end date (defaults to TODAY)&lt;BR /&gt;&lt;BR /&gt;$ @dayssince 10-apr-1988&lt;BR /&gt;  DAYS = 8340   Hex = 00002094  Octal = 00000020224&lt;BR /&gt;$ @dayssince 10-apr-1888&lt;BR /&gt;  DAYS = 44864   Hex = 0000AF40  Octal = 00000127500&lt;BR /&gt;$ @dayssince 17-nov-1858 18-jun-9990&lt;BR /&gt;  DAYS = 2970000   Hex = 002D5190  Octal = 00013250620&lt;BR /&gt;&lt;BR /&gt;DAYSSINCE.COM&lt;BR /&gt;$ ON WARNING THEN EXIT&lt;BR /&gt;$ s=F$CVTIME(p1,"ABSOLUTE","DATE")&lt;BR /&gt;$ e=F$CVTIME(p2,,"DATE")&lt;BR /&gt;$ c=0&lt;BR /&gt;$ d=5000&lt;BR /&gt;$ G: IF F$CVTIME("''s'+''d'-0",,"DATE").LTS.e&lt;BR /&gt;$ THEN&lt;BR /&gt;$   c=c+d&lt;BR /&gt;$   s=F$CVTIME("''s'+''d'-0","ABSOLUTE")&lt;BR /&gt;$   GOTO G&lt;BR /&gt;$ ENDIF&lt;BR /&gt;$ x=d&lt;BR /&gt;$ F: t=F$CVTIME("''s'+''x'-0",,"DATE")&lt;BR /&gt;$ IF t.NES.e&lt;BR /&gt;$ THEN&lt;BR /&gt;$   d=(d+1)/2&lt;BR /&gt;$   IF t.LTS.e&lt;BR /&gt;$   THEN&lt;BR /&gt;$     x=x+d&lt;BR /&gt;$   ELSE&lt;BR /&gt;$     x=x-d&lt;BR /&gt;$   ENDIF&lt;BR /&gt;$   GOTO F&lt;BR /&gt;$ ENDIF&lt;BR /&gt;$ days=c+x&lt;BR /&gt;$ SHOW SYM days&lt;BR /&gt;</description>
      <pubDate>Tue, 08 Feb 2011 23:08:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/continuous-day-count/m-p/4749929#M41126</guid>
      <dc:creator>John Gillings</dc:creator>
      <dc:date>2011-02-08T23:08:57Z</dc:date>
    </item>
    <item>
      <title>Re: Continuous day count</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/continuous-day-count/m-p/4749930#M41127</link>
      <description>&lt;!--!*#--&gt;And here's the C version (could not resist :-)&lt;BR /&gt;&lt;BR /&gt;$ pipe cc days ; link days ; run days&lt;BR /&gt;8340 days&lt;BR /&gt;$&lt;BR /&gt;&lt;BR /&gt;days.c&lt;BR /&gt;------&lt;BR /&gt;#include &lt;STDIO.H&gt;&lt;BR /&gt;#include &lt;TIME.H&gt;&lt;BR /&gt;&lt;BR /&gt;int main() {&lt;BR /&gt;  static struct tm tm_beg;&lt;BR /&gt;  int days;&lt;BR /&gt;&lt;BR /&gt;  tm_beg.tm_mday = 10;  /* 10th  */&lt;BR /&gt;  tm_beg.tm_mon  = 3;   /* April */&lt;BR /&gt;  tm_beg.tm_year = 88;  /* 1988  */&lt;BR /&gt;  tm_beg.tm_isdst = -1; /* don't know if this is STD or DST in your timezone */&lt;BR /&gt;&lt;BR /&gt;  days = (time(0) - mktime(&amp;amp;tm_beg)) / (24*3600) + 1;&lt;BR /&gt;  printf("%d days\n", days);&lt;BR /&gt;}&lt;/TIME.H&gt;&lt;/STDIO.H&gt;</description>
      <pubDate>Wed, 09 Feb 2011 00:43:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/continuous-day-count/m-p/4749930#M41127</guid>
      <dc:creator>WW304289</dc:creator>
      <dc:date>2011-02-09T00:43:13Z</dc:date>
    </item>
    <item>
      <title>Re: Continuous day count</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/continuous-day-count/m-p/4749931#M41128</link>
      <description>WW304289, that's the most clever !&lt;BR /&gt;&lt;BR /&gt;Just a question about the "+1" :&lt;BR /&gt;would one like the number of days between yesterday and today to be 2 ?&lt;BR /&gt;I prefer to leave off "+1".</description>
      <pubDate>Wed, 09 Feb 2011 08:01:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/continuous-day-count/m-p/4749931#M41128</guid>
      <dc:creator>Joseph Huber_1</dc:creator>
      <dc:date>2011-02-09T08:01:00Z</dc:date>
    </item>
    <item>
      <title>Re: Continuous day count</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/continuous-day-count/m-p/4749932#M41129</link>
      <description>&lt;!--!*#--&gt;Joseph,&lt;BR /&gt;&lt;BR /&gt;"&lt;BR /&gt;Just a question about the "+1" :&lt;BR /&gt;would one like the number of days between yesterday and today to be 2 ?&lt;BR /&gt;I prefer to leave off "+1". &lt;BR /&gt;"&lt;BR /&gt;&lt;BR /&gt;It depends on whether you want to count current (partial) day as a day. If you don't, leave "+1" off. Probably, NOT counting partial day is more intuitive than counting it.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;-Boris&lt;BR /&gt;  &lt;BR /&gt;</description>
      <pubDate>Wed, 09 Feb 2011 18:03:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/continuous-day-count/m-p/4749932#M41129</guid>
      <dc:creator>WW304289</dc:creator>
      <dc:date>2011-02-09T18:03:22Z</dc:date>
    </item>
  </channel>
</rss>

