Comparing Date to DateTime using UFT API
Question ID: 107858
1
0

I’m trying to compare an expected date value to an API datetime field. I need to know how to use the UFT API Custom Expression to grab only the Date portion of the DateTime returned value. Or, is there another way that I can compare the two dates? Currently, when I pass in my expected date only value (because I don’t know the exact time), the T00:00:00.0000000 value is appended to the date passed in. So, I end up with an expected value = 2024-09-24T00:00:00.0000000. Of course, when I go to compare the expected value to the actual value (2024-09-24T01:31:27.0150000), the test fails because the times don’t match. I’m trying to see how I can get around this issue and compare only the date portions. Thanks

Marked as spam
Posted by (Questions: 22, Answers: 6)
Asked on September 8, 2017 5:48 pm
178 views
Answers (1)
0
Private answer

Have you use the Date/Time Difference Activity ( found in the UFT Tool Box under Date/Time)? I would think that could handle the issue you are seeing.

Marked as spam
Posted by (Questions: 2, Answers: 98)
Answered on September 8, 2017 5:48 pm
EyeOnTesting

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

X
Scroll to Top