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

  • You have configured Datediff to calculate the difference in days-type interval. You probably want the result to be shown in hours. Try using
    DateDiff( "h", StartDate_PV.value.value, EndTime_PV.value.value )



    Thank you for your answer

    I got the same result again with "h" (12/30/1899 1:00 AM).
    I have tried with "n" (which is for minutes) and i got 12/31/1899 1:00 AM

    I really don't understand what is going on here, but i need a solution. :(
    Any help?

Reply

  • You have configured Datediff to calculate the difference in days-type interval. You probably want the result to be shown in hours. Try using
    DateDiff( "h", StartDate_PV.value.value, EndTime_PV.value.value )



    Thank you for your answer

    I got the same result again with "h" (12/30/1899 1:00 AM).
    I have tried with "n" (which is for minutes) and i got 12/31/1899 1:00 AM

    I really don't understand what is going on here, but i need a solution. :(
    Any help?

Children
No Data