cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Custom Test Result Date Fields Not Formatting

nborrerojr.
12-Amethyst

Custom Test Result Date Fields Not Formatting

I have two date fields that I created for my test results: Execution Date and Execution Modified Date. When I kick them out to an html report, they do not format per the definition in the report wizard. Other date and date time fields do though. Is this a bug or am I doing something incorrectly? I can use JavaScript as a work around but I would prefer to not have to do that.

4 REPLIES 4

To elaborate a bit more...

After </head> and before <body>, I have: <%dateformat%> and <%datetimeformat%>

In the report wizard, I have specified:

Date Format: dd MMM yy

Date Time Format: dd-MMM-yy HH:mm

When I run the report, the normal Modified field spits out: 08-Jun-15 10:02

My custom test result field spits out: Jun 2, 2015 6:24:02 PM

HI Nolin,

I am not sure if internally the custom test result fields are stored as chars only. This would clarify why it comes out like it comes.

Depending on the critcality of your request, you may ask our Support how to solve.

- Volker

Volker,

I have it solved for now just by using JavaScript to parse it as a string and reformat it.

The field type is date. If it's stored as chars like you're suggesting, then that would explain the behavior. It sounds like that would be a bug since the reports should treat fields based on how they are defined in the admin client.

Thanks,

Nolin

a few more details...

I use moment.js and the below code to format the date.

function ConvertDate(originalDate) {   

    var newDate = moment(originalDate, "MMM D, YYYY h:mm:ss A");

    newDate = newDate.format("DD MMM YY HHmm");

    return newDate;

   }

Announcements


Top Tags