hexagon logo

Difference between 2 dates times in Basic Script.

Anyone know of a way to get the difference between 2 date/times in Basic Script? Similar to the datediff function in VBA.
Parents
  • I wrote this "code", just using assignments, to measure the time of exe of a prog :
    Those lines at the start :

    ASSIGN/V2=SYSTEMTIME("HH:mm:ss")
    ASSIGN/HOUR1=ELEMENT(1,":",V2)
    ASSIGN/MINUTE1=ELEMENT(2,":",V2)
    ASSIGN/SEC1=ELEMENT(3,":",V2)


    Those lines at the end of the prog :


    ASSIGN/V4=SYSTEMTIME("HH:mm:ss")
    ASSIGN/HOUR2=ELEMENT(1,":",V4)
    ASSIGN/MINUTE2=ELEMENT(2,":",V4)
    ASSIGN/SEC2=ELEMENT(3,":",V4)
    IF/HOUR2<HOUR1
    ASSIGN/HOUR2=HOUR2+24
    END_IF/
    ASSIGN/V5=(HOUR2-HOUR1)*3600+(MINUTE2-MINUTE1)*60+(SEC2-SEC1)
    COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
    "Time = "+V5+" seconds"


    It works if the prog is less than 2 days !!!!!Smiley

    For dates, it's more hard, because months are not always the same !!!!!
Reply
  • I wrote this "code", just using assignments, to measure the time of exe of a prog :
    Those lines at the start :

    ASSIGN/V2=SYSTEMTIME("HH:mm:ss")
    ASSIGN/HOUR1=ELEMENT(1,":",V2)
    ASSIGN/MINUTE1=ELEMENT(2,":",V2)
    ASSIGN/SEC1=ELEMENT(3,":",V2)


    Those lines at the end of the prog :


    ASSIGN/V4=SYSTEMTIME("HH:mm:ss")
    ASSIGN/HOUR2=ELEMENT(1,":",V4)
    ASSIGN/MINUTE2=ELEMENT(2,":",V4)
    ASSIGN/SEC2=ELEMENT(3,":",V4)
    IF/HOUR2<HOUR1
    ASSIGN/HOUR2=HOUR2+24
    END_IF/
    ASSIGN/V5=(HOUR2-HOUR1)*3600+(MINUTE2-MINUTE1)*60+(SEC2-SEC1)
    COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
    "Time = "+V5+" seconds"


    It works if the prog is less than 2 days !!!!!Smiley

    For dates, it's more hard, because months are not always the same !!!!!
Children
No Data