Need to find the datediff for the below code?
Hi Team,
I have a requirement where I need to get the FromDate and ToDate form the incomming request and find the datediff to send the response. I have pasted the below code, could you guide me in finding the datediff ?
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
def holder = groovyUtils.getXmlHolder(mockRequest.requestContent)
def FromDate = holder.getNodeValue("declare namespace ns='http://mebank.com.au/Enterprise/AccountManagement/wsdl/AccountService/1.0';//ns:getTransactionList/msgGetTransactionListRequest/SearchCriteria/DateRange/FromDate")
def ToDate = holder.getNodeValue("declare namespace ns='http://mebank.com.au/Enterprise/AccountManagement/wsdl/AccountService/1.0';//ns:getTransactionList/msgGetTransactionListRequest/SearchCriteria/DateRange/ToDate")
def Fromdate = new Date().parse("yyyy-MM-dd'T'HH:mm:ss.000+11:00", FromDate).format('yyyy-MM-dd')
def Todate = new Date().parse("yyyy-MM-dd'T'HH:mm:ss.000+11:00", ToDate).format('yyyy-MM-dd')
def intValue = Todate.minus(Fromdate) Is this the correct formate to find the datediff?
def Nofodays = intValue.toInteger()
Error: Failed to dispatch using script; java.lang.NumberFormatException: For input string: "2020-02-19"
Based on NoofDay I need to send the Resposne:
1. return Weekly,
2. return Fortnight,
3. return Month,
4. return Year,
Thanks
Senthil. M