<?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: Converting COMPARISON to ABSOLUTE time in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/converting-comparison-to-absolute-time/m-p/5062226#M85756</link>
    <description>Thanks all.&lt;BR /&gt;&lt;BR /&gt;You've confirmed what I found, and have given me some ideas.</description>
    <pubDate>Wed, 08 Aug 2007 16:01:05 GMT</pubDate>
    <dc:creator>Jack Trachtman</dc:creator>
    <dc:date>2007-08-08T16:01:05Z</dc:date>
    <item>
      <title>Converting COMPARISON to ABSOLUTE time</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/converting-comparison-to-absolute-time/m-p/5062219#M85749</link>
      <description>Hopefully I'm just missing something obvious, but I don't see a DCL lexical func that will convert COMPARSION time back to ABSOLUTE time.&lt;BR /&gt;&lt;BR /&gt;I often store COMPARISON times in records so that I can, well, compare times.  Now, I'd like be able to use some the F$CVTIME options to get WEEKDAY, etc, but don't see an easy way to convert the time back to ABSOLUTE, which F$CVTIME seems to require.  (Also - I noticed that the F$DELTA lexical only uses ABSOLUTE times).</description>
      <pubDate>Wed, 08 Aug 2007 12:28:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/converting-comparison-to-absolute-time/m-p/5062219#M85749</guid>
      <dc:creator>Jack Trachtman</dc:creator>
      <dc:date>2007-08-08T12:28:44Z</dc:date>
    </item>
    <item>
      <title>Re: Converting COMPARISON to ABSOLUTE time</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/converting-comparison-to-absolute-time/m-p/5062220#M85750</link>
      <description>Not sure exactly what you're asking, but f$cvtime is capable of outputting absolute time.  "ABSOLUTE" in the second argument which is the output time format.&lt;BR /&gt;</description>
      <pubDate>Wed, 08 Aug 2007 13:11:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/converting-comparison-to-absolute-time/m-p/5062220#M85750</guid>
      <dc:creator>EdgarZamora</dc:creator>
      <dc:date>2007-08-08T13:11:47Z</dc:date>
    </item>
    <item>
      <title>Re: Converting COMPARISON to ABSOLUTE time</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/converting-comparison-to-absolute-time/m-p/5062221#M85751</link>
      <description>it will do absolute, here a what day I&lt;BR /&gt;use.  Dean&lt;BR /&gt;**********&lt;BR /&gt;$!&lt;BR /&gt;$! whatday.com dean mcgorrill 08-mar-2007&lt;BR /&gt;$!&lt;BR /&gt;$! return weekday and time, pass a date via p1 parameter&lt;BR /&gt;$!&lt;BR /&gt;$ wo=="write sys$output"&lt;BR /&gt;$ daytime = f$cvtime(p1,,"weekday") + " " + -&lt;BR /&gt;            f$cvtime(p1,"absolute","datetime")&lt;BR /&gt;$ daytime = f$extract(0,f$locate(".",daytime),daytime)&lt;BR /&gt;$ wo daytime&lt;BR /&gt;$ exit 1&lt;BR /&gt;</description>
      <pubDate>Wed, 08 Aug 2007 13:24:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/converting-comparison-to-absolute-time/m-p/5062221#M85751</guid>
      <dc:creator>Dean McGorrill</dc:creator>
      <dc:date>2007-08-08T13:24:30Z</dc:date>
    </item>
    <item>
      <title>Re: Converting COMPARISON to ABSOLUTE time</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/converting-comparison-to-absolute-time/m-p/5062222#M85752</link>
      <description>Jack,&lt;BR /&gt;&lt;BR /&gt;Interesting. This seems to be an error in the documentation that was fixed sometime between Version 6.2 and Version 8.2 (I do not have the time to narrow it further).&lt;BR /&gt;&lt;BR /&gt;Off the top of my head, given the fact that F$CVTIME does not do it directly, I would engage in a little slight of hand. F$CVTIME is still known to work for DELTA and combination times. I would use F$ELEMENT to extract the year, insert it into a January 1, xxxx absolute date and use the rest of the comparison date to create a delta time, using F$CVTIME to then get the various components.&lt;BR /&gt;&lt;BR /&gt;If I am not being clear, please let me know.&lt;BR /&gt;&lt;BR /&gt;- Bob Gezelter, &lt;A href="http://www.rlgsc.com" target="_blank"&gt;http://www.rlgsc.com&lt;/A&gt;</description>
      <pubDate>Wed, 08 Aug 2007 13:57:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/converting-comparison-to-absolute-time/m-p/5062222#M85752</guid>
      <dc:creator>Robert Gezelter</dc:creator>
      <dc:date>2007-08-08T13:57:16Z</dc:date>
    </item>
    <item>
      <title>Re: Converting COMPARISON to ABSOLUTE time</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/converting-comparison-to-absolute-time/m-p/5062223#M85753</link>
      <description>Jack,&lt;BR /&gt;&lt;BR /&gt;You are not missing anything, there is no lexical function to convert from ABSOLUTE format to DELTA format (at least not that I am aware of).&lt;BR /&gt;&lt;BR /&gt;It can be done in one line of DCL, although it isn't pretty.  Because the COMPARISON format is well defined, we can extract the year, and day without a problem, the trick is to convert the numerical month to the three character month name abreviation.  The easiest way to do that is with the f$element function.&lt;BR /&gt;&lt;BR /&gt;Here's the an example converting a comparision time in the symbol ct to an absolute time in symbol at.&lt;BR /&gt;&lt;BR /&gt;Note: it does not handle DELTA times.&lt;BR /&gt;&lt;BR /&gt;$ ct=f$cvtime("")      &lt;BR /&gt;$ sho sym ct&lt;BR /&gt;  CT = "2007-08-08 15:12:09.25"&lt;BR /&gt;$ at=f$extract(8,2,ct)+"-"+f$element(f$extract(5,2,ct),",",",JAN,FEB,MAR,APR,MAY,JUN,JUL,AUG,SEP,OCT,NOV,DEC")+"-"+f$extract(0,4,ct)+f$extract(10,12,ct)&lt;BR /&gt;$ sho sym at&lt;BR /&gt;  AT = "08-AUG-2007 15:12:09.25"&lt;BR /&gt;&lt;BR /&gt;It would be nice to have an F$CVCOMPARISON_TIME or F$CVCTIME function with an optional "DCL" qualifier to place a ":" between the date and time.&lt;BR /&gt;&lt;BR /&gt;Here's a more understandable version (not tested, just typed in)&lt;BR /&gt;&lt;BR /&gt;$ dd = f$extract(8,2,ct)&lt;BR /&gt;$ mm = f$extract(5,2,ct)&lt;BR /&gt;$ mmm = f$element(mm,"|","|JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC")&lt;BR /&gt;$ yyyy = f$extract(0,4,ct)&lt;BR /&gt;$ time = f$extract(11,11,ct)&lt;BR /&gt;$ at = dd + "-" + mmm + "-" + yyyy + " " + time&lt;BR /&gt;&lt;BR /&gt;Jon</description>
      <pubDate>Wed, 08 Aug 2007 14:46:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/converting-comparison-to-absolute-time/m-p/5062223#M85753</guid>
      <dc:creator>Jon Pinkley</dc:creator>
      <dc:date>2007-08-08T14:46:26Z</dc:date>
    </item>
    <item>
      <title>Re: Converting COMPARISON to ABSOLUTE time</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/converting-comparison-to-absolute-time/m-p/5062224#M85754</link>
      <description>What I meant was "there is no lexical function to comvert from COMPARISON time to ABSOLUTE time"  Sorry for the confusion.&lt;BR /&gt;&lt;BR /&gt;Jon</description>
      <pubDate>Wed, 08 Aug 2007 14:49:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/converting-comparison-to-absolute-time/m-p/5062224#M85754</guid>
      <dc:creator>Jon Pinkley</dc:creator>
      <dc:date>2007-08-08T14:49:04Z</dc:date>
    </item>
    <item>
      <title>Re: Converting COMPARISON to ABSOLUTE time</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/converting-comparison-to-absolute-time/m-p/5062225#M85755</link>
      <description>Using DCL you'll have to hard-code the conversion. You can avoid coding up the month table by using a second line to grab the month and exploiting f$cvtime (as Bob suggests). The amount of typing is similar.&lt;BR /&gt;&lt;BR /&gt;$ CT = "2007-01-01 15:12:09.25"&lt;BR /&gt;$ x = 31*f$extr(5,2,ct)-31&lt;BR /&gt;$ write sys$output f$extr(8,2,CT)+"-"+f$elem(1,"-",f$cvtime("1-JAN +''x'-","ABSOLUTE"))+"-"+f$extr(0,4,ct)+f$ext(10,99,ct)&lt;BR /&gt;01-JAN-2007 15:12:09.25&lt;BR /&gt;&lt;BR /&gt;$ CT = "2007-12-31 15:12:09.25"&lt;BR /&gt;$ x = 31*f$extr(5,2,ct)-31&lt;BR /&gt;$ write sys$output f$extr(8,2,CT)+"-"+f$elem(1,"-",f$cvtime("1-JAN +''x'-","ABSOLUTE"))+"-"+f$extr(0,4,ct)&lt;BR /&gt;31-DEC-2007&lt;BR /&gt;&lt;BR /&gt;The helper variable 'x' is a number of days since the start of the year garantueed to be in te right month, but an slowly increasing day in each month.&lt;BR /&gt;&lt;BR /&gt;fwiw,&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 08 Aug 2007 15:42:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/converting-comparison-to-absolute-time/m-p/5062225#M85755</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2007-08-08T15:42:33Z</dc:date>
    </item>
    <item>
      <title>Re: Converting COMPARISON to ABSOLUTE time</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/converting-comparison-to-absolute-time/m-p/5062226#M85756</link>
      <description>Thanks all.&lt;BR /&gt;&lt;BR /&gt;You've confirmed what I found, and have given me some ideas.</description>
      <pubDate>Wed, 08 Aug 2007 16:01:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/converting-comparison-to-absolute-time/m-p/5062226#M85756</guid>
      <dc:creator>Jack Trachtman</dc:creator>
      <dc:date>2007-08-08T16:01:05Z</dc:date>
    </item>
    <item>
      <title>Re: Converting COMPARISON to ABSOLUTE time</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/converting-comparison-to-absolute-time/m-p/5062227#M85757</link>
      <description>After thinking a bit more about this, instead of a new lexical function, it would probably be better to modify f$cvtime to accept a fourth parameter, input-format, that would default to "ABSOLUTE" to be compatible with existing code.&lt;BR /&gt;Specifcally, it would be nice if the following was allowed and worked.&lt;BR /&gt;&lt;BR /&gt;$ AT = lib$cvtime("2007-01-02 17:59:59.27","ABSOLUTE",,"COMPARISON") ! not implemented&lt;BR /&gt;$ show symbol at&lt;BR /&gt;  AT = "02-JAN-2007 17:59:59.27" ! this is just a wishlist&lt;BR /&gt;&lt;BR /&gt;Jon</description>
      <pubDate>Wed, 08 Aug 2007 16:14:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/converting-comparison-to-absolute-time/m-p/5062227#M85757</guid>
      <dc:creator>Jon Pinkley</dc:creator>
      <dc:date>2007-08-08T16:14:27Z</dc:date>
    </item>
    <item>
      <title>Re: Converting COMPARISON to ABSOLUTE time</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/converting-comparison-to-absolute-time/m-p/5062228#M85758</link>
      <description>Jon,&lt;BR /&gt;&lt;BR /&gt;I agree with your suggested addition, but I'd also like F$CVTIME and F$DELTA to accept any time format as input!</description>
      <pubDate>Wed, 08 Aug 2007 16:38:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/converting-comparison-to-absolute-time/m-p/5062228#M85758</guid>
      <dc:creator>Jack Trachtman</dc:creator>
      <dc:date>2007-08-08T16:38:40Z</dc:date>
    </item>
    <item>
      <title>Re: Converting COMPARISON to ABSOLUTE time</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/converting-comparison-to-absolute-time/m-p/5062229#M85759</link>
      <description>Jack,&lt;BR /&gt;&lt;BR /&gt;Can you provide some examples of what you would expect to work, with input and output?  "any time format as input" is a bit ambiguous.&lt;BR /&gt;&lt;BR /&gt;Jon&lt;BR /&gt;&lt;BR /&gt;P.S. Does anyone know if there is anything like the old DECUS SIR (System Improvement Request) still around?  I have seen references to "Advocacy" but don't know where it is or if it is still active.</description>
      <pubDate>Wed, 08 Aug 2007 17:37:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/converting-comparison-to-absolute-time/m-p/5062229#M85759</guid>
      <dc:creator>Jon Pinkley</dc:creator>
      <dc:date>2007-08-08T17:37:22Z</dc:date>
    </item>
    <item>
      <title>Re: Converting COMPARISON to ABSOLUTE time</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/converting-comparison-to-absolute-time/m-p/5062230#M85760</link>
      <description>I'd be happy enough if a date string starting with 4 numerics and a dash (2007-) outside the range 1..31 would simply indicate a comparison time format. That particular combo is currently invalid as it is not a valid day-in-the-month.&lt;BR /&gt;&lt;BR /&gt;The only price to pay for that convention would be the inability to default to the current year. For example, 20 august could not be: "-08-20" because this already means today minus 8 days and 20 hours.&lt;BR /&gt;Maybe 0000- or 0- can be used to express 'current year'.&lt;BR /&gt;&lt;BR /&gt;A nice benefit of the comparison time is that it is language independend. (btw... the 'JAN' I hardcoded in my earlier example works in a good many western languages)&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Wed, 08 Aug 2007 18:13:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/converting-comparison-to-absolute-time/m-p/5062230#M85760</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2007-08-08T18:13:17Z</dc:date>
    </item>
    <item>
      <title>Re: Converting COMPARISON to ABSOLUTE time</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/converting-comparison-to-absolute-time/m-p/5062231#M85761</link>
      <description>Date manipulation in DCL has improved in recent times. Most recently with F$DELTA. F$CVTIME was a huge step forward back in V5, but there's still several large holes, such as Jack's observation in this thread.&lt;BR /&gt; &lt;BR /&gt;OpenVMS already has a fairly general mechanism for dealing with the multitude of possible date/time formats using the LIB$ date/time formatting routines. See LIB$INIT_DATE_TIME_CONTEXT and friends for details.&lt;BR /&gt;&lt;BR /&gt;It's effectively a $FAO like format control string to define the position and format of various components of date and time values. See the default absolute time format:&lt;BR /&gt; &lt;BR /&gt;$ SHOW LOGICAL/TABLE=*DT*&lt;BR /&gt;&lt;BR /&gt;(LNM$DT_FORMAT_TABLE)&lt;BR /&gt;&lt;BR /&gt;  "LIB$DATE_FORMAT_001" = "!DB-!MAAU-!Y4"&lt;BR /&gt;  "LIB$TIME_FORMAT_001" = "!H04:!M0:!S0.!C2"&lt;BR /&gt;&lt;BR /&gt;Using this mechanism, a generic date conversion lexical function would accept an input date/time string and format string, and an output format string:&lt;BR /&gt;&lt;BR /&gt; output=F$FORMAT_DATE(date_in [,[in_format] [,[out_format]]])&lt;BR /&gt;&lt;BR /&gt;Converting from comparison format to absolute format would therefore be:&lt;BR /&gt;&lt;BR /&gt;$ abs=F$FORMAT_TIME(comp,-&lt;BR /&gt;"!Y4-!MM-!DD !H04:!M0:!S0.!C2",-&lt;BR /&gt;"!DB-!MAAU-!Y4 !H04:!M0:!S0.!C2")&lt;BR /&gt;&lt;BR /&gt;or, since a missing format string would use the system default, the second format string could be omitted. I'd also expect to be able to specify a logical name as the format string.&lt;BR /&gt;&lt;BR /&gt;I don't know if HP has a working method for users to request enhancements. I'd guess that logging a case against a service contract and asking the engineer to submit a formal request to engineering would be the most likely to succeed.</description>
      <pubDate>Wed, 08 Aug 2007 19:22:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/converting-comparison-to-absolute-time/m-p/5062231#M85761</guid>
      <dc:creator>John Gillings</dc:creator>
      <dc:date>2007-08-08T19:22:23Z</dc:date>
    </item>
  </channel>
</rss>

