Date/Time Calculation

Help
2004-09-27
2013-05-14
  • Bill Jansen
    Bill Jansen
    2004-09-27

    Can anyone point me to a utility package or other source for Date & Time Calculation?  I believe someone had implemented the DATECALC EXEC, but can't seem to find it anywhere.  Windoze platform...

     
    • Mark Hessling
      Mark Hessling
      2004-09-27

      What sort of date/time calculation are you after?

      With Regina 3.3 you can use the 'T' option to DATE and TIME BIFs. The T option gives you time as a Unix time_t; the number of seconds since 1 Jan 1970. This make it easy to to do date and time calculations. (Just remember to set NUMERIC DIGITS 12)

       
      • Bill Jansen
        Bill Jansen
        2004-09-27

        I get a text file with the date and time already in their format.  I read the file, parse line-by-line, and need to do some math on the dates and times, but can't convert them to T (or anything else).  I had begun a subroutine, but thought there *must* be something like DATECALC around already.  I remember it even checked for leap years, etc...

         
        • Please be more specific:  what format do you recieve the date and time in?  (is it mm/dd/yy? or dd/mm/yy? or ccyymmddhhnnss? etc)

          What calculations do you need to perform (add/subtract days/hours to their number? determine number of days/hours remaining? determine age of subject? etc.)

          Do your calculations have to be in just days, or days and hours?

          Any other details will be useful.

           
          • Bill Jansen
            Bill Jansen
            2004-09-29

            The data comes to me like this:
            17698743 OLIVERWH11     2004-08-11 11.03.07 IDLE   UPM    TRBL     187621 Scrubber #2 air leak.
            17698743 OLIVERWH11     2004-08-11 11.03.07 UPMOK  UPMW   TRBL     187621 Scrubber #2 air leak.
            17699096 OLIVERWH11     2004-08-11 11.32.02 UPM    UPM    STRUPM   632948 Scrubber #2 air leak.
            17699096 OLIVERWH11     2004-08-11 11.32.02 UPMW   UPMACK STRUPM   632948 Scrubber #2 air leak.
            17700059 OLIVERWH11     2004-08-11 13.07.57 UPM    STBY   ENDUPM   632948 repl.scrub 1 drive shaft bearings
            17700059 OLIVERWH11     2004-08-11 13.07.57 UPM    STBY   ENDUPM   632948 repr.air leak
            17700059 OLIVERWH11     2004-08-11 13.07.57 UPMACK UPMCMP ENDUPM   632948 repl.scrub 1 drive shaft bearings

            ...but I can easily mass-change the delimiters if necessary.  These are the various stages of tool maintenance activity, and I need to calculate :
            Wait Time for Service
            Troubleshoot & Repair
            Wait for parts (could be weeks!)
            Total Downtime
            If I can't find a workalike for DATECALC, I think I will wimp out and just add things up until I get to 999.9 hours (after that, who cares?) and just report everything in hours.  I have written a short subroutine that will do that much without too much trouble.