This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Time Difference between two properties

Hello I need help with creating Time Difference property.

Property Values Examples:

Start Time: 02:57:37 PM
End Time: 02:58:01 PM

I have tried:

Option Explicit

CONST START_TIME_ID = 1213
CONST END_TIME_ID = 1214

dim StartDate_PV: set StartDate_PV = PropertyValues.SearchForProperty(START_TIME_ID)

dim EndTime_PV: set EndTime_PV = PropertyValues.SearchForProperty(END_TIME_ID)

if  ( NOT StartDate_PV.value.IsNull() ) AND ( NOT EndTime_PV.value.IsNull() ) THEN
  output = DateDiff( "d", StartDate_PV.value.value, EndTime_PV.value.value )
else

  output.SetValueToNULL MFDatatypeInteger

end if


But I'm getting Datestamp result: 12/30/1899 1:00 AM

Any solution to this?
Parents

  • What is the datatype on your output property?
    Is it configured to be a Text or Number type?
    If you have configured it to be Date or Time that would explain the outcome...


    Thank you so much!

    It was set to Time type. I changed it to Text now it works perfectly.
    This is already enough for me but it would be nice if i can convert for example result in seconds to time format?
    for example:

    3681 seconds difference to be displayed as 01:01:22 ?
Reply

  • What is the datatype on your output property?
    Is it configured to be a Text or Number type?
    If you have configured it to be Date or Time that would explain the outcome...


    Thank you so much!

    It was set to Time type. I changed it to Text now it works perfectly.
    This is already enough for me but it would be nice if i can convert for example result in seconds to time format?
    for example:

    3681 seconds difference to be displayed as 01:01:22 ?
Children
No Data