Create variable from DateTime.Now

In a C# test script I have created a variable to create an Employer Name based on the word “Automation” + the date and time at the point of creation, that way the name is always unique when running the tests i.e.

_EmployerTestName = “Automation” + dateTime;

How do I do this in UiPath Studio to create an Employer Name based on the time it was created that I can then use in my tests?

Hi

Welcome to UiPath forum

U can mention like this in expression in an assign activity

Stroutput = “your employee name”+”_”+Datetime.Now.ToString

To know more about Datetime have a view on this

Cheers @simon.bunyard

Hi @Palaniyappan thanks so much for getting back to me so quickly

I have created an Assign activity and in the properties I have set the following,
image

but I’m getting an error that you can see at the top

I’m sure I’m doing something obviously wrong but can’t tell what!

1 Like

Well I think it’s the double quotes and direction of that quotes
I would recommend to type in again the same
Sometimes copy paste might change the direction of double quotes

@simon.bunyard

Hi @simon.bunyard ,

Try the following:

"Automation"+DateAndTime.DateString

Or

"Automation"+DateAndTime.Now.ToString()

Regards,

Hi @simon.bunyard

Welcome to UiPath community

Try to type the expression

"Automation" + DateTime.Now.ToString

Regards
Gokul