- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Continuous day count
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
тАО02-08-2011 04:49 AM
тАО02-08-2011 04:49 AM
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.
Kind Regards,
Niall
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-08-2011 04:58 AM
тАО02-08-2011 04:58 AM
Re: Continuous day count
See HELP LEXICAL F$DELTA_TIME.
If You have a system older than VMS 7.3-2 and a fortran compiler, then You may use my version at
http://wwwvms.mpp.mpg.de/~huber/util/main/f$delta_time.HTML
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-08-2011 05:25 AM
тАО02-08-2011 05:25 AM
Re: Continuous day count
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?
Regards and Thanks,
Niall
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-08-2011 05:30 AM
тАО02-08-2011 05:30 AM
Re: Continuous day count
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-08-2011 06:02 AM
тАО02-08-2011 06:02 AM
Re: Continuous day count
http://dcl.openvms.org/stories.php?story=07/01/16/4051929
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-08-2011 06:48 AM
тАО02-08-2011 06:48 AM
Re: Continuous day count
This is what I enter and get nothing back at all, not even an error:
@time_difference.com; 16-JAN-2008:13:40:00 DELTA_TIME "TIME" 16-JAN-2007:13:40:00
Thanks again,
Niall
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-08-2011 07:07 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-08-2011 07:30 AM
тАО02-08-2011 07:30 AM
Re: Continuous day count
So this works, kind off. for some reason the day i was in 1988 does not, but one year later it does. Any ideas?
Prompt> @time_difference 10-Apr-1989:12:00:00 delta_time "TIME" 8-FEB-2011:00:00:00
Prompt> sh sym DELTA_TIME
DELTA_TIME == "-7974-12:00:00.00"
Prompt> @time_difference 10-Apr-1988:12:00:00 delta_time "TIME" 8-FEB-2011:00:00:00
%DCL-W-IVATIME, invalid absolute time - use DD-MMM-YYYY:HH:MM:SS.CC format
\8-FEB-2011 00:00:00.00-16383-0:0\
%DCL-W-IVATIME, invalid absolute time - use DD-MMM-YYYY:HH:MM:SS.CC format
\8-FEB-2011 00:00:00.00-32767-0:0\
Thanks,
Niall
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-08-2011 07:39 AM
тАО02-08-2011 07:39 AM
Re: Continuous day count
So to use it properly you'd have to go through the years in chunks of less than 9999 days.
See example below.
Google finds a good few examples, and the TIME_DIFFERENCE one on OpenVMS.org is fine, but a bit much.
A cure but noisy, general purpose example is:
http://www.convertunits.com/dates/from/Nov+17,+1858/to/Feb+8,+2011
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.
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.
Below two examples to just calculate the days since a reference date (not before 17-NOV-1858).
You can edit in your own reference date to speed it up a little if need be.
Turn into a subroutine as needed to calculate a difference.
Hein
$ type DAY_SINCE_17_NOV_1858.com
$
$ target = 123 ! This integer will become a string if Convert time works
$ target = F$CVT(P1,"ABSOLUTE","DATE")
$ IF F$TYPE(target) .NES. "STRING" THEN EXIT 16
$ year = 1858
$ days = 45 - 365
$ target_year = 'F$CVT( target,,"YEAR")
$
$year_loop:
$ year = year + 1
$ days = days + 365
$ IF F$CVTIME("1-MAR-''year' -1-",,"DAY") THEN days = days + 1 ! 28=false, 29=true
$ IF year.LT.target_year THEN GOTO year_loop
$
$ date = "1-JAN-''year'"
$day_loop:
$ IF date .EQS.target THEN GOTO done
$ date = F$CVT("''date' +1-","ABSOLUTE","DATE")
$ days = days + 1
$ goto day_loop
$
$ done:
$ write sys$output p1, " is ", days, " days since 17-NOV-1858 "
For OpenVMS 7.3-2 or better with F$DELTA
$
$ target = 123 ! This integer will become a string if Convert time works
$ target = F$CVT(P1,"ABSOLUTE","DATE")
$ IF F$TYPE(target) .NES. "STRING" THEN EXIT 16
$ days = 0
$ start_date = "17-NOV-"
$ start_year = 1858
$ target_year = 'F$CVT( target,,"YEAR")
$ target_date = target - "''target_year'"
$chunck_loop:
$ IF ( target_year - start_year ) .LE. 25 THEN GOTO last_chunck
$ start_next = start_year + 25
$ days = days + f$elem(0," ",f$delta( start_date + "''start_year'", start_date + "''start_next'" ))
$ start_year = start_next
$ goto chunck_loop
$
$last_chunck:
$ dddd = f$delta( start_date + "''start_year'", target)
$ days = days + f$elem(0," ", f$edit( dddd, "TRIM" ))
$ write sys$output p1, " is ", days, " days since 17-NOV-1858 "
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-08-2011 07:50 AM
тАО02-08-2011 07:50 AM
Re: Continuous day count
Just if it is fails with less than 9999, then it will probably fail also with looping it.
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... :)
Thanks,
Niall