AClark
16 years agoNew Contributor
Properties Syntax for a DateTime string to be used in a Request.
I'm having a problem with the Properties syntax.
I'm trying to create a datatime string value like this: //YYDDDHHMMSSMMM (14 chars)
Here is c# code to do it.
public string GenReferenceIdentifier()
{
DateTime dtNow = DateTime.Now;
string strYear = dtNow.Year.ToString().Remove(0, 2);
return (strYear.ToString().PadLeft(2, '0')
+ dtNow.DayOfYear.ToString().PadLeft(3, '0')
+ dtNow.Hour.ToString().PadLeft(2, '0')
+ dtNow.Minute.ToString().PadLeft(2, '0')
+ dtNow.Second.ToString().PadLeft(2, '0')
+ dtNow.Millisecond.ToString().PadLeft(3, '0'));
}
But how do I do this in soapUI ?
I tried something like this but I get errors.
${=(i= new java.util.Date();i.day;i.month;i.year;)}
This syntax works but I need a value from the current date time.
${=(int)(Math.random()*1000)}
I'm new to this tool so any helpful information about properties syntax would be great.
Thanks for any help.
I'm trying to create a datatime string value like this: //YYDDDHHMMSSMMM (14 chars)
Here is c# code to do it.
public string GenReferenceIdentifier()
{
DateTime dtNow = DateTime.Now;
string strYear = dtNow.Year.ToString().Remove(0, 2);
return (strYear.ToString().PadLeft(2, '0')
+ dtNow.DayOfYear.ToString().PadLeft(3, '0')
+ dtNow.Hour.ToString().PadLeft(2, '0')
+ dtNow.Minute.ToString().PadLeft(2, '0')
+ dtNow.Second.ToString().PadLeft(2, '0')
+ dtNow.Millisecond.ToString().PadLeft(3, '0'));
}
But how do I do this in soapUI ?
I tried something like this but I get errors.
${=(i= new java.util.Date();i.day;i.month;i.year;)}
This syntax works but I need a value from the current date time.
${=(int)(Math.random()*1000)}
I'm new to this tool so any helpful information about properties syntax would be great.
Thanks for any help.