Export Date not Timestamp when exporting using RPE
I have fields in RQM where I am assigning a Date to a Test Case and when I export to RPE I want to display only the date - preferably in a UK style format dd/mm/yyyy.
However in RPE it always displays the a timestamp as well as the date in us format yy/mm/dd. Is there a way to change this without having to use Java Script to parse and split the string up before re-assembling with just the informaiton I am interested in exporting. |
One answer
If you are printing the date (dateTime) in a Text element, set Date pattern (in Properties->Specific tab for the Text element) property.
As an alternate, you can use a JavaScript function to change the date format. These functions can be readily found in .js files under %rpe_home%\utils\scripts, if you are using RPE 2.1 or later. Here is a sample function: //function to change date format to "MMM dd, yyyy" function changeDateFormat(date) { try { var currDtFmt = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); var curDt = currDtFmt.parse(date); var expDtFmt = new java.text.SimpleDateFormat("MMM dd, yyyy"); var dateString = expDtFmt.format(curDt).toString() _sessionLogger.info("##### data string: " + dateString); return dateString; } catch(err) { java.lang.System.out.print( err); return date; } } Comments
Ben Sharples
commented Nov 10 '16, 7:24 a.m.
Propoerties changes doesn't work. (I suspect because I have to grab the value, assign it to a variable and then print the variable.)
Subramanya Prasad Pilar
commented Nov 10 '16, 12:23 p.m.
I ran a quick test and just setting Date format to yyyy-MM-dd works fine.
|
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.