Appending date and time to output report (using newman-reporter-htmlextra)


I am wishing to produce an HTML report via Newman (newman-reporter-htmlextra), giving the output report a title of my choice, adding date and time to end of file name.

So at the moment, I am using -

–reporter-htmlextra-export path\path\path\test.html

which produces an HTML report called ‘test.html’.

I want to produce a report called ‘test_04022020_1202.html’ (for example).

How do I go about doing this?


It is not possible until you try to run collection from a cmd prompt.
It is possible if you run the collection programatically where you can add logic to get the current dateTime.

Thanks for the fast response.

Yes, I am running from a cmd prompt. I was looking to see if there was a quick way of adding date and time to end of HTML report that is produced.

‘Running the collection programmatically’ is new for me. I guess I need to figure out a) how to run a collection programmatically, and b) how to include required logic into the program.

Unless, of course, there is a quicker way :slight_smile:

Hey @mrobbo85,

From the terminal, you can use date to help with this:

--reporter-htmlextra-export "test_$(date '+%d%m%Y_%H%M').html"

I’m not sure what the equivalent syntax would be for Windows, I think it might be the same :thinking:

1 Like

Hi @dannydainton ,

Cheers for this. On Windows, this just outputs a report with the title ‘test_$(date ‘+%d%m%Y_%H%M’).html’.

I’ll keep trying!



I don’t have a windows machine but having a quick search around, it looks to be slightly trickier for windows, mainly due to the syntax.

I think it’s likely to be something like:


You also still have the option of just removing that export flag and it will create the report, with the default name which includes the collection name plus a timestamp. That gets stored in the /newman directory.

1 Like


Nice one Danny! A sterling job considering you didn’t have a windows machine to hand. This worked for me =


Awesome! Glad I could help! :grin: