PS Query & SQL

 View Only
  • 1.  Elapsed Time / Timestamp Differences - Any (Easy) Expresssions?

    Posted 4 hours ago

    Hi folks!

    I'm trying to determine elapsed time using the difference between two timestamps. This is the current expression I am using:

    (TO_TIMESTAMP(CAST((A.ENDDTTM) AS TIMESTAMP),'YYYY-MM-DD-HH24.MI.SS.FF') -  TO_TIMESTAMP(CAST((A.BEGINDTTM) AS TIMESTAMP),'YYYY-MM-DD-HH24.MI.SS.FF')) * 86400

    It works most of the time, but does fail on occasion, especially if the difference is too large.

    Was curious to know if anyone has anything better that works more reliably. Google has not been my friend, and AI has been equally unhelpful, so I figured I would consult RI (real intelligence).

    Thanks in advance!



    ------------------------------
    Mark Russom B.Sc. FLMI ACS
    Business Systems Lead
    McMaster University
    ------------------------------

    Message from the HEUG Marketplace:
    ------------------------------
    Find, Review, and Engage with Higher Education-focused solution providers, products, and services using the HEUG Marketplace.
    ------------------------------
    Alliance 2026 Recordings are coming soon!


  • 2.  RE: Elapsed Time / Timestamp Differences - Any (Easy) Expresssions?

    Posted 3 hours ago

    Not sure if this will work but it has worked for us.  I take no credit for this...  Had someone help me with this.

     

    (TO_DATE(SUBSTR(A.ENDDTTM,1,16),'YYYY-MM-DD-HH24.MI') - TO_DATE(SUBSTR(A.BEGINDTTM,1,16),'YYYY-MM-DD-HH24.MI')) *24 *60

     

    This gives me the number of minutes a process runs....  You can change it for what you want.

     




    Alliance 2026 Recordings are coming soon!


  • 3.  RE: Elapsed Time / Timestamp Differences - Any (Easy) Expresssions?

    Posted 3 hours ago

    I got this from Jeffie Brooks to break the time difference between 2 timestamps into  hours:minutes:seconds.   You likely can use datediff also.

     

    SUBSTR(ENDDTTM - BEGINDTTM,12,8)

     

     

     

     

    Thanks!

    Dana Pawlowicz

    Business Systems Analyst Sr - ERP

    Business Enterprise Systems and Technologies
    Digital Technology Solutions

    University of Cincinnati

    51 Goodman Dr.

    Cincinnati, Oh 45221

     

     




    Alliance 2026 Recordings are coming soon!