I have the if statement that I need help with.
What I am trying to do is check inside xml document in objXMLInputDoc to see if the NewWarrantStatus/WarrantStatusTime is less than current time.
In my if statement I put < 4 which is I think should be 4 minutes... but am not sure if that's correct.
How do I do this?
objXMLInputDoc has the following xml
What I have triedCode:<?xml version="1.0" encoding="UTF-8"?> <UpdateWarrantStatus> <WarrantNumber> <ID>2</ID> </WarrantNumber> <CurrentWarrantStatus> <WarrantStatusTypeText code="RECALLED">Recalled Inactive</WarrantStatusTypeText> <WarrantStatusDate>2018-10-16</WarrantStatusDate> </CurrentWarrantStatus> <NewWarrantStatus> <WarrantStatusTypeText code="IBARCLR">Warrant Cleared by Arrest</WarrantStatusTypeText> <WarrantStatusDate>2018-10-17</WarrantStatusDate> <WarrantStatusTime>12:10:00</WarrantStatusTime> <WarrantStatusComment>New status</WarrantStatusComment> </NewWarrantStatus> </UpdateWarrantStatus>
Code:dtmNewWarrantStatusDateTime = CDate(objXMLInputDoc.DocumentElement.SelectSingleNode("msc:NewWarrantStatus/msc:WarrantStatusDate", objXMLNameSpaceManager).InnerText + " " + objXMLInputDoc.DocumentElement.SelectSingleNode("msc:NewWarrantStatus/msc:WarrantStatusTime", objXMLNameSpaceManager).InnerText) 'I am using < 4 thinking this can be 4 minutes earlier than current time but it is not working If ((dtmNewWarrantStatusDateTime.Date = Date.Today) And (DateDiff(DateInterval.Minute, Date.Now, dtmNewWarrantStatusDateTime) < 1)) Then Else strErrorResponse = "A Warrant Status Date and Time combination is invalid because time is in the future. i.e more than 4 minutes." objXMLInputDoc.DocumentElement.SetAttribute("error", strErrorResponse) End If


Reply With Quote
