- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Converting COMPARISON to ABSOLUTE time
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-08-2007 05:28 AM
тАО08-08-2007 05:28 AM
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).
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-08-2007 06:11 AM
тАО08-08-2007 06:11 AM
Re: Converting COMPARISON to ABSOLUTE time
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-08-2007 06:24 AM
тАО08-08-2007 06:24 AM
Re: Converting COMPARISON to ABSOLUTE time
use. Dean
**********
$!
$! whatday.com dean mcgorrill 08-mar-2007
$!
$! return weekday and time, pass a date via p1 parameter
$!
$ wo=="write sys$output"
$ daytime = f$cvtime(p1,,"weekday") + " " + -
f$cvtime(p1,"absolute","datetime")
$ daytime = f$extract(0,f$locate(".",daytime),daytime)
$ wo daytime
$ exit 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-08-2007 06:57 AM
тАО08-08-2007 06:57 AM
Re: Converting COMPARISON to ABSOLUTE time
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).
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.
If I am not being clear, please let me know.
- Bob Gezelter, http://www.rlgsc.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-08-2007 07:46 AM
тАО08-08-2007 07:46 AM
SolutionYou 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).
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.
Here's the an example converting a comparision time in the symbol ct to an absolute time in symbol at.
Note: it does not handle DELTA times.
$ ct=f$cvtime("")
$ sho sym ct
CT = "2007-08-08 15:12:09.25"
$ 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)
$ sho sym at
AT = "08-AUG-2007 15:12:09.25"
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.
Here's a more understandable version (not tested, just typed in)
$ dd = f$extract(8,2,ct)
$ mm = f$extract(5,2,ct)
$ mmm = f$element(mm,"|","|JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC")
$ yyyy = f$extract(0,4,ct)
$ time = f$extract(11,11,ct)
$ at = dd + "-" + mmm + "-" + yyyy + " " + time
Jon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-08-2007 07:49 AM
тАО08-08-2007 07:49 AM
Re: Converting COMPARISON to ABSOLUTE time
Jon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-08-2007 08:42 AM
тАО08-08-2007 08:42 AM
Re: Converting COMPARISON to ABSOLUTE time
$ CT = "2007-01-01 15:12:09.25"
$ x = 31*f$extr(5,2,ct)-31
$ 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)
01-JAN-2007 15:12:09.25
$ CT = "2007-12-31 15:12:09.25"
$ x = 31*f$extr(5,2,ct)-31
$ write sys$output f$extr(8,2,CT)+"-"+f$elem(1,"-",f$cvtime("1-JAN +''x'-","ABSOLUTE"))+"-"+f$extr(0,4,ct)
31-DEC-2007
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.
fwiw,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-08-2007 09:01 AM
тАО08-08-2007 09:01 AM
Re: Converting COMPARISON to ABSOLUTE time
You've confirmed what I found, and have given me some ideas.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-08-2007 09:14 AM
тАО08-08-2007 09:14 AM
Re: Converting COMPARISON to ABSOLUTE time
Specifcally, it would be nice if the following was allowed and worked.
$ AT = lib$cvtime("2007-01-02 17:59:59.27","ABSOLUTE",,"COMPARISON") ! not implemented
$ show symbol at
AT = "02-JAN-2007 17:59:59.27" ! this is just a wishlist
Jon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-08-2007 09:38 AM
тАО08-08-2007 09:38 AM
Re: Converting COMPARISON to ABSOLUTE time
I agree with your suggested addition, but I'd also like F$CVTIME and F$DELTA to accept any time format as input!