Hello, I am using a custom java action that accepts entity name and xpath expression and does a retrieve. The reason am using java action is since my xpath is genearted dynamically based on seach criteria entered in a search screen. The solution works fine, but i am stuck with date comparision, I am building xpath like ‘ date column > $date variable’, but I am don’t know how to convert string to date in xpath. formatDateTimeUTC doesn’t work in xpath. if someone can provide some pointer it will be helpful. '//ProjectFoundation.Project[ CrossChargeable= ' + '''' + 'Y' + '''' + ' and (ClosedDate > ' + 'formatDateTimeUTC(' + '''' + toString($WeekendDate) + '''' + ',' + '''' + 'MM/dd/yy, HH:mm am' + '''' + ')' + ' or ClosedDate = empty) ' + ' and contains(ProjectFoundation.Project_ProjectCustomers/ProjectFoundation.ProjectCustomers/CustomerName, ''JAC'') '+ ']'
FormatDateTimeUTC returns a string. You are comparing the string to ClosedDate. Is ClosedDate also a string? If so, then take into account that when comparing date strings using > they need to be formatted yyyyMMddhhMMss to get the desired result.
answered
Tim v Steenbergen
0
Thanks much!
answered
rajesh khatri
-1
Hi Rajesh,
You can use SimpleDate Format which converts the string to date format in Java
eg:
import java.text.SimpleDateFormat;
import java.util.Date;
String sDate1="31/12/1998";
Date date1=new SimpleDateFormat("dd/MM/yyyy").parse(sDate1);