Can anyone tell me if there's a utility that will return the current date/time? (eg. 2004-02-04-14.57.38). I looked at "ACCEPT fieldname FROM DATE", but that doesn't get more accurate than the day (ie. No hours, minutes, and seconds).
when you use ACCEPT DATE and ACCEPT TIME there is a chance that they don't fit with the moment you take it, for example when the program does this on the moment when the date is changing.
Suppose the program is taking time and date on 4 april 2004 23:59:59. When you first take the date and after that the time, it can happen that you get:
date: 040404
time: 00000001
or the other way around:
time: 23595999
date: 040405
In both cases time and date are inconsistent with the moment you got it. The difference is almost a complete day. If you take the date first and after that the time, you should check if the date is changed. If it is, you should take the time again.
If the FUNCTION CURRENT-DATE is available, you don't have this potential trouble, so it is better to use this function.
Not sure of the the portability, but RM/Cobol provides/allows
Code:
ACCEPT date-field FROM DATE-AND-TIME
that guarantees a consistent timestamp. This returns the date/time in YYYYMMDDHHMMSSHH format. I guess this is essentially the equivalent of the CURRENT-DATE INTRINSIC function. RM/Cobol does not provide the intrinsic functions (or at least I haven't seen them yet).
"Code what you mean,
and mean what you code!
But by all means post your code!"
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.